Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/python-jsonrpc-server/files/, dev-python/python-jsonrpc-server/
Date: Wed, 19 Aug 2020 22:50:42
Message-Id: 1597877390.09253c79f1f9e34ed0007733cca09c73ee70245d.mattst88@gentoo
1 commit: 09253c79f1f9e34ed0007733cca09c73ee70245d
2 Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 17 19:51:28 2020 +0000
4 Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 19 22:49:50 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=09253c79
7
8 dev-python/python-jsonrpc-server: Add Python 3.8 compatibility
9
10 Closes: https://github.com/gentoo/gentoo/pull/16732
11 Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
12
13 ...ython-3.8-fixes-for-endpoint-and-tests-37.patch | 84 ++++++++++++++++++++++
14 .../python-jsonrpc-server-0.3.4.ebuild | 7 +-
15 2 files changed, 89 insertions(+), 2 deletions(-)
16
17 diff --git a/dev-python/python-jsonrpc-server/files/python-jsonrpc-server-0.3.4-Python-3.8-fixes-for-endpoint-and-tests-37.patch b/dev-python/python-jsonrpc-server/files/python-jsonrpc-server-0.3.4-Python-3.8-fixes-for-endpoint-and-tests-37.patch
18 new file mode 100644
19 index 00000000000..8d597ddda03
20 --- /dev/null
21 +++ b/dev-python/python-jsonrpc-server/files/python-jsonrpc-server-0.3.4-Python-3.8-fixes-for-endpoint-and-tests-37.patch
22 @@ -0,0 +1,84 @@
23 +From 7987e30c99edddab8acbf567bad0ebf2d1c3381d Mon Sep 17 00:00:00 2001
24 +From: Ben Greiner <code@××××××××××.de>
25 +Date: Mon, 17 Aug 2020 21:28:03 +0200
26 +Subject: [PATCH] Python 3.8 fixes for endpoint and tests (#37)
27 +
28 +* fix endpoint exception lists for Python 3.8
29 +Author: @maximbaz according to #33
30 +
31 +* fix test_writer_bad_message
32 +not only windows can have problems with serializing datetime
33 +
34 +Co-authored-by: Carlos Cordoba <ccordoba12@×××××.com>
35 +Co-authored-by: Marko Bakovic <delta003@××××××××××××××××××××.com>
36 +---
37 + pyls_jsonrpc/endpoint.py | 1 +
38 + test/test_endpoint.py | 4 ++--
39 + test/test_streams.py | 19 +++++++++----------
40 + 3 files changed, 12 insertions(+), 12 deletions(-)
41 +
42 +diff --git a/pyls_jsonrpc/endpoint.py b/pyls_jsonrpc/endpoint.py
43 +index e8bfb5b..0caf612 100644
44 +--- a/pyls_jsonrpc/endpoint.py
45 ++++ b/pyls_jsonrpc/endpoint.py
46 +@@ -236,6 +236,7 @@ class Endpoint(object):
47 + if error is not None:
48 + log.debug("Received error response to message %s: %s", msg_id, error)
49 + request_future.set_exception(JsonRpcException.from_dict(error))
50 ++ return
51 +
52 + log.debug("Received result for message %s: %s", msg_id, result)
53 + request_future.set_result(result)
54 +diff --git a/test/test_endpoint.py b/test/test_endpoint.py
55 +index 47a038b..b954732 100644
56 +--- a/test/test_endpoint.py
57 ++++ b/test/test_endpoint.py
58 +@@ -115,9 +115,9 @@ def test_request_cancel(endpoint, consumer):
59 + 'params': {'id': MSG_ID}
60 + })
61 +
62 +- with pytest.raises(exceptions.JsonRpcException) as exc_info:
63 ++ with pytest.raises((exceptions.JsonRpcException, futures.CancelledError)) as exc_info:
64 + assert future.result(timeout=2)
65 +- assert exc_info.type == exceptions.JsonRpcRequestCancelled
66 ++ assert exc_info.type in (exceptions.JsonRpcRequestCancelled, futures.CancelledError)
67 +
68 +
69 + def test_consume_notification(endpoint, dispatcher):
70 +diff --git a/test/test_streams.py b/test/test_streams.py
71 +index 8c2e93e..480a73b 100644
72 +--- a/test/test_streams.py
73 ++++ b/test/test_streams.py
74 +@@ -97,7 +97,8 @@ def test_writer(wfile, writer):
75 +
76 + def test_writer_bad_message(wfile, writer):
77 + # A datetime isn't serializable(or poorly serializable),
78 +- # ensure the write method doesn't throw
79 ++ # ensure the write method doesn't throw, but the result could be empty
80 ++ # or the correct datetime
81 + import datetime
82 + writer.write(datetime.datetime(
83 + year=2019,
84 +@@ -108,12 +109,10 @@ def test_writer_bad_message(wfile, writer):
85 + second=1,
86 + ))
87 +
88 +- if os.name == 'nt':
89 +- assert wfile.getvalue() == b''
90 +- else:
91 +- assert wfile.getvalue() == (
92 +- b'Content-Length: 10\r\n'
93 +- b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
94 +- b'\r\n'
95 +- b'1546304461'
96 +- )
97 ++ assert wfile.getvalue() in [
98 ++ b'',
99 ++ b'Content-Length: 10\r\n'
100 ++ b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
101 ++ b'\r\n'
102 ++ b'1546304461'
103 ++ ]
104 +--
105 +2.26.2
106 +
107
108 diff --git a/dev-python/python-jsonrpc-server/python-jsonrpc-server-0.3.4.ebuild b/dev-python/python-jsonrpc-server/python-jsonrpc-server-0.3.4.ebuild
109 index d4423e655f5..637c726e751 100644
110 --- a/dev-python/python-jsonrpc-server/python-jsonrpc-server-0.3.4.ebuild
111 +++ b/dev-python/python-jsonrpc-server/python-jsonrpc-server-0.3.4.ebuild
112 @@ -3,7 +3,7 @@
113
114 EAPI=7
115
116 -PYTHON_COMPAT=( python3_7 )
117 +PYTHON_COMPAT=( python3_{7,8} )
118
119 inherit distutils-r1
120
121 @@ -26,6 +26,9 @@ DEPEND="test? (
122 dev-python/pylint[${PYTHON_USEDEP}]
123 )"
124
125 -PATCHES=( "${FILESDIR}/${P}-remove-pytest-cov-dep.patch" )
126 +PATCHES=(
127 + "${FILESDIR}"/${P}-remove-pytest-cov-dep.patch
128 + "${FILESDIR}"/${P}-Python-3.8-fixes-for-endpoint-and-tests-37.patch
129 +)
130
131 distutils_enable_tests pytest