mbr / tinyrpc

A compact, modular transport and protocol agnostic RPC library. Does jsonrpc v2.
https://tinyrpc.readthedocs.org
MIT License
156 stars 53 forks source link

Unit tests in tests/test_dispatch.py fail with pytest > 4 #75

Closed amoralej closed 3 years ago

amoralej commented 5 years ago

When using pytest > 4 (I know it's pinned in requirements.txt to 3.6.3 but it's still problematic when running unit tests with distro packages which are updated to > 4, as in example in Fedora), unit tests fail:

$ tox -epy37 GLOB sdist-make: /home/amoralej/tinyrpc/setup.py py37 inst-nodeps: /home/amoralej/tinyrpc/.tox/dist/tinyrpc-1.0.1.zip py37 installed: atomicwrites==1.1.5,attrs==18.1.0,certifi==2019.3.9,chardet==3.0.4,coverage==4.5.1,gevent==1.3.4,gevent-websocket==0.10.1,greenlet==0.4.13,idna==2.8,importlib-metadata==0.17,more-itertools==4.2.0,packaging==17.1,pluggy==0.12.0,py==1.5.4,pyparsing==2.2.0,pytest==4.4.0,pytest-cov==2.5.1,pyzmq==17.1.0,requests==2.22.0,six==1.11.0,tinyrpc==1.0.1,tox==3.1.2,urllib3==1.25.3,virtualenv==16.0.0,Werkzeug==0.14.1,zipp==0.5.1,zmq==0.0.0 py37 run-test-pre: PYTHONHASHSEED='2890615897' py37 runtests: commands[0] | pytest -rs =============================================================================================== test session starts =============================================================================================== platform linux -- Python 3.7.3, pytest-4.4.0, py-1.5.4, pluggy-0.12.0 cachedir: .tox/py37/.pytest_cache rootdir: /home/amoralej/tinyrpc plugins: cov-2.5.1 collected 591 items

tests/test_client.py ...................................................................................................................................................................................... [ 30%] ........................................................................................................................................................................................................... [ 65%] .....................................................ssssssssssssssssssssssssssssssssssssssssssssssssssssss [ 83%] tests/test_dispatch.py .........F............ [ 86%] tests/test_jsonrpc.py ............................................ [ 94%] tests/test_protocols.py ....... [ 95%] tests/test_server.py .. [ 95%] tests/test_transport.py ........ [ 97%] tests/test_wsgi_transport.py ...............s [100%]

==================================================================================================== FAILURES ===================================================================================================== _ test_batchdispatch Fixture "mock_request" called directly. Fixtures are not meant to be called directly, but are created automatically when test functions request them as parameters. See https://docs.pytest.org/en/latest/fixture.html for more information about fixtures, and https://docs.pytest.org/en/latest/deprecations.html#calling-fixtures-directly about how to update your code.

lnoor commented 3 years ago

solved in https://github.com/mbr/tinyrpc/commit/1b98a82231fdb5a11863fa5b754fbf8544ce36a6