0rpc / zerorpc-python

zerorpc for python
http://www.zerorpc.io
Other
3.17k stars 378 forks source link

0.6.3: pytest is failing in tests/test_client_async.py #239

Closed kloczek closed 2 years ago

kloczek commented 3 years ago

Just normal build, install and test cycle used on building package from non-root account:

================================================================================== ERRORS ================================================================================== _____ ERROR collecting tests/test_client_async.py ____ /usr/lib/python3.8/site-packages/_pytest/python.py:578: in _importtestmodule mod = import_path(self.fspath, mode=importmode) /usr/lib/python3.8/site-packages/_pytest/pathlib.py:524: in import_path importlib.import_module(module_name) /usr/lib64/python3.8/importlib/init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level)

:1014: in _gcd_import ??? :991: in _find_and_load ??? :975: in _find_and_load_unlocked ??? :671: in _load_unlocked ??? /usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:161: in exec_module source_stat, co = _rewrite_test(fn, self.config) /usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:354: in _rewrite_test tree = ast.parse(source, filename=fn_) /usr/lib64/python3.8/ast.py:47: in parse return compile(source, filename, mode, flags, E File "/home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3/tests/test_client_async.py", line 56 E async_result = client.add(1, 4, async=True) E ^ E SyntaxError: invalid syntax ========================================================================= short test summary info ========================================================================== ERROR tests/test_client_async.py !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ============================================================================= 1 error in 0.55s ============================================================================= pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo().terminate()'. ```
kloczek commented 3 years ago

Even after add that file to pytest ignore list it is yet another issue

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-zerorpc-0.6.3-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-zerorpc-0.6.3-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra --ignore tests/test_client_async.py
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
benchmark: 3.4.1 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
rootdir: /home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3
plugins: forked-1.3.0, shutil-1.7.0, virtualenv-1.7.0, expect-1.1.0, flake8-1.0.7, timeout-1.4.2, betamax-0.8.1, freezegun-0.4.2, case-1.5.3, isort-1.3.0, aspectlib-1.5.2, toolbox-0.5, mock-3.6.1, rerunfailures-9.1.1, requests-mock-1.9.3, cov-2.12.1, pyfakefs-4.5.0, flaky-3.7.0, benchmark-3.4.1, xdist-2.3.0, pylama-7.7.1, datadir-1.3.1, regressions-2.2.0, cases-3.6.3, hypothesis-6.14.4, xprocess-0.18.1, black-0.3.12, checkdocs-2.7.1, anyio-3.3.0, Faker-8.11.0
collected 79 items

. .                                                                                                                                                                  [  1%]
tests/test_buffered_channel.py ..........                                                                                                                            [ 13%]
tests/test_channel.py ...                                                                                                                                            [ 17%]
tests/test_client.py ..                                                                                                                                              [ 20%]
tests/test_client_heartbeat.py ......                                                                                                                                [ 27%]
tests/test_events.py .......                                                                                                                                         [ 36%]
tests/test_heartbeat.py ........                                                                                                                                     [ 46%]
tests/test_middleware.py ..........                                                                                                                                  [ 59%]
tests/test_middleware_before_after_exec.py .........                                                                                                                 [ 70%]
tests/test_middleware_client.py ..........                                                                                                                           [ 83%]
tests/test_pubpush.py ....                                                                                                                                           [ 88%]
tests/test_reqstream.py .                                                                                                                                            [ 89%]
tests/test_server.py .....F.                                                                                                                                         [ 98%]
tests/test_zmq.py .                                                                                                                                                  [100%]

================================================================================= FAILURES =================================================================================
_________________________________________________________________________ test_exception_compat_v1 _________________________________________________________________________

    def test_exception_compat_v1():
        endpoint = random_ipc_endpoint()

        class MySrv(zerorpc.Server):
            pass

        srv = MySrv()
        srv.bind(endpoint)
        gevent.spawn(srv.run)

        client_events = zerorpc.Events(zmq.DEALER)
        client_events.connect(endpoint)
        client = zerorpc.ChannelMultiplexer(client_events, ignore_broadcast=True)

        rpccall = client.channel()
        rpccall.emit('donotexist', tuple())
        event = rpccall.recv()
        print(event)
        assert event.name == 'ERR'
        (name, msg, tb) = event.args
        print('detailed error', name, msg, tb)
        assert name == 'NameError'
        assert msg == 'donotexist'

        rpccall = client.channel()
        rpccall.emit('donotexist', tuple(), xheader={'v': 1})
        event = rpccall.recv()
        print(event)
        assert event.name == 'ERR'
        (msg,) = event.args
        print('msg only', msg)
>       assert msg == "NameError('donotexist',)"
E       assert "NameError('donotexist')" == "NameError('donotexist',)"
E         - NameError('donotexist',)
E         ?                       -
E         + NameError('donotexist')

tests/test_server.py:218: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
<b''> ERR {'message_id': b'224a5e63ca9e483386d7319f3ca0df07', 'v': 3, 'response_to': b'224a5e62ca9e483386d7319f3ca0df07'} ['NameError', 'donotexist', 'Traceback (most recent call last):\n  File "/home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3/zerorpc/core.py", line 152, in _async_task\n    raise NameError(event.name)\nNameError: donotexist\n']
detailed error NameError donotexist Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3/zerorpc/core.py", line 152, in _async_task
    raise NameError(event.name)
NameError: donotexist

<b''> ERR {'message_id': b'224a5e65ca9e483386d7319f3ca0df07', 'v': 3, 'response_to': b'224a5e64ca9e483386d7319f3ca0df07'} ["NameError('donotexist')"]
msg only NameError('donotexist')
---------------------------------------------------------------------------- Captured log call -----------------------------------------------------------------------------
ERROR    zerorpc.core:core.py:130
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3/zerorpc/core.py", line 152, in _async_task
    raise NameError(event.name)
NameError: donotexist
ERROR    zerorpc.core:core.py:130
Traceback (most recent call last):
  File "/home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3/zerorpc/core.py", line 152, in _async_task
    raise NameError(event.name)
NameError: donotexist
------------------------------------------------------------------------- Captured stdout teardown -------------------------------------------------------------------------
unlink /tmp/zerorpc_test_socket_7471519937920215.sock
============================================================================= warnings summary =============================================================================
tests/test_reqstream.py::test_rcp_streaming
  /home/tkloczko/rpmbuild/BUILD/zerorpc-python-0.6.3/tests/test_reqstream.py:61: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
    assert isinstance(r, collections.Iterator)

-- Docs: https://docs.pytest.org/en/stable/warnings.html
========================================================================= short test summary info ==========================================================================
FAILED tests/test_server.py::test_exception_compat_v1 - assert "NameError('donotexist')" == "NameError('donotexist',)"
================================================================= 1 failed, 78 passed, 1 warning in 36.40s =================================================================
pytest-xprocess reminder::Be sure to terminate the started process by running 'pytest --xkill' if you have not explicitly done so in your fixture with 'xprocess.getinfo(<process_name>).terminate()'.