Skip to content

Tests fails in Debian with python 3.8 #43

@elMor3no

Description

@elMor3no

im trying to packages python-jsonrpc-server for Debian but i get this issue on the test with python3.8
Im try to use the patch from https://git.archlinux.org/svntogit/community.git/tree/trunk/python-3.8.patch?h=packages/python-jsonrpc-server but i get this issue:

I: pybuild base:217: cd /pkg-python-jsonrpc-server/python-jsonrpc-server/.pybuild/cpython3_3.8/build; python3.8 -m pytest test
============================= test session starts ==============================
platform linux -- Python 3.8.4rc1, pytest-4.6.11, py-1.8.1, pluggy-0.13.0
rootdir: /pkg-python-jsonrpc-server/python-jsonrpc-server, inifile: setup.cfg, testpaths: test
plugins: cov-2.8.1
collected 27 items

test/test_endpoint.py ......................                             [ 81%]
test/test_streams.py ...FF                                               [100%]

=================================== FAILURES ===================================
_________________________________ test_writer __________________________________

wfile = <_io.BytesIO object at 0x7f61fd7cf1d0>
writer = <pyls_jsonrpc.streams.JsonRpcStreamWriter object at 0x7f61fd7ccdf0>

    def test_writer(wfile, writer):
        writer.write({
            'id': 'hello',
            'method': 'method',
            'params': {}
        })
    
        if os.name == 'nt':
            assert wfile.getvalue() == (
                b'Content-Length: 49\r\n'
                b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
                b'\r\n'
                b'{"id": "hello", "method": "method", "params": {}}'
            )
        else:
>           assert wfile.getvalue() == (
                b'Content-Length: 44\r\n'
                b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
                b'\r\n'
                b'{"id":"hello","method":"method","params":{}}'
            )
E           assert b'Content-Len..."params": {}}' == b'Content-Leng...,"params":{}}'
E             At index 17 diff: 57 != 52
E             Left contains 5 more items, first extra item: 58
E             Use -v to get the full diff

test/test_streams.py:90: AssertionError
___________________________ test_writer_bad_message ____________________________

wfile = <_io.BytesIO object at 0x7f61fd7b9db0>
writer = <pyls_jsonrpc.streams.JsonRpcStreamWriter object at 0x7f61fe0e23d0>

    def test_writer_bad_message(wfile, writer):
        # A datetime isn't serializable(or poorly serializable),
        # ensure the write method doesn't throw
        import datetime
        writer.write(datetime.datetime(
            year=2019,
            month=1,
            day=1,
            hour=1,
            minute=1,
            second=1,
        ))
    
        if os.name == 'nt':
            assert wfile.getvalue() == b''
        else:
>           assert wfile.getvalue() == (
                b'Content-Length: 10\r\n'
                b'Content-Type: application/vscode-jsonrpc; charset=utf8\r\n'
                b'\r\n'
                b'1546304461'
            )
E           AssertionError: assert b'' == b'Content-Length: 10\r\nCon...rset=utf8\r\n\r\n1546304461'
E             Right contains 88 more items, first extra item: 67
E             Use -v to get the full diff

test/test_streams.py:114: AssertionError
------------------------------ Captured log call -------------------------------
ERROR    pyls_jsonrpc.streams:streams.py:112 Failed to write message to output file 2019-01-01 01:01:01
Traceback (most recent call last):
  File "/pkg-python-jsonrpc-server/python-jsonrpc-server/.pybuild/cpython3_3.8/build/pyls_jsonrpc/streams.py", line 98, in write
    body = json.dumps(message, **self._json_dumps_args)
  File "/usr/lib/python3.8/json/__init__.py", line 234, in dumps
    return cls(
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type datetime is not JSON serializable
- generated xml file: /pkg-python-jsonrpc-server/python-jsonrpc-server/.pybuild/cpython3_3.8/build/pytest.xml -

--------- coverage: platform linux, python 3.8.4-candidate-1 ---------
Name                    Stmts   Miss  Cover
-------------------------------------------
test/__init__.py            0      0   100%
test/test_endpoint.py     133      4    97%
test/test_streams.py       46      2    96%
-------------------------------------------
TOTAL                     179      6    97%
Coverage HTML written to dir htmlcov

===================== 2 failed, 25 passed in 0.40 seconds ======================
Coverage.py warning: Module pyls was never imported. (module-not-imported)
E: pybuild pybuild:352: test: plugin distutils failed with: exit code=1: cd /pkg-python-jsonrpc-server/python-jsonrpc-server/.pybuild/cpython3_3.8/build; python3.8 -m pytest test

Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions