anyio
anyio copied to clipboard
Pytest configuration is slightly off
On a system where anyio isn't already available, building is ok but testing fails. The reason is that at the testing stage, neither anyio nor its pytest plugin get found. I could get further by running:
PYTHONPATH=build/lib python3 -m pytest -rsx --tb=short --strict-config --strict-markers -p anyio -p anyio.pytest_plugin -p no:asynci
(here I added -p anyio.pytest_plugin so the pytest plugin is searched, and the PYTHONPATH makes both -p anyio and -p anyio.pytest_plugin actually work: nothing is installed yet! )
That will still get failures in the pytest plugin tests though: test_hypothesis_function_mark.py::test_anyio_mark_first and test_hypothesis_function_mark.py::test_anyio_mark_last both fail with the same error:
E hypothesis.errors.InvalidArgument: Hypothesis doesn't know how to run async test functions like test_anyio_mark_last. You'll need to write a custom executor, or use a library like pytest-asyncio or pytest-trio which can handle the translation for you.
E See https://hypothesis.readthedocs.io/en/latest/details.html#custom-function-execution
test_hypothesis_function_mark.py:13: InvalidArgument
Which is strange because of the -p no:asyncio... unless those tests aren't marked as needing asyncio while they do?
AnyIO does not use pytest-asyncio, and its presence is actually harmful. Hence the -p no:asyncio
.
Tests run correctly when you use tox
, yes?
Closing due to lack of responses.