Repository navigation
When running tests, @pytest.mark.trio is not recognized #103
Copy link
Copy link
Open
Description
I'm running the tests as I described here (PYTHONPATH="." pytest --pyargs pytest_trio), but it seems it doesn't recognize the marker correctly:
====================================================== ERRORS =======================================================
_____________________________ ERROR collecting pytest_trio/_tests/test_clock_fixture.py _____________________________
pytest_trio/_tests/test_clock_fixture.py:5: in <module>
@pytest.mark.trio
/usr/lib/python3.8/site-packages/_pytest/mark/structures.py:513: in __getattr__
warnings.warn(
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.trio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
______________________________ ERROR collecting pytest_trio/_tests/test_contextvars.py ______________________________
pytest_trio/_tests/test_contextvars.py:35: in <module>
???
/usr/lib/python3.8/site-packages/_pytest/mark/structures.py:513: in __getattr__
warnings.warn(
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.trio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
_____________________________ ERROR collecting pytest_trio/_tests/test_fixture_names.py _____________________________
pytest_trio/_tests/test_fixture_names.py:11: in <module>
???
/usr/lib/python3.8/site-packages/_pytest/mark/structures.py:513: in __getattr__
warnings.warn(
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.trio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
____________________________ ERROR collecting pytest_trio/_tests/test_fixture_nursery.py ____________________________
pytest_trio/_tests/test_fixture_nursery.py:17: in <module>
???
/usr/lib/python3.8/site-packages/_pytest/mark/structures.py:513: in __getattr__
warnings.warn(
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.trio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
________________________ ERROR collecting pytest_trio/_tests/test_hypothesis_interaction.py _________________________
pytest_trio/_tests/test_hypothesis_interaction.py:19: in <module>
@pytest.mark.trio
/usr/lib/python3.8/site-packages/_pytest/mark/structures.py:513: in __getattr__
warnings.warn(
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.trio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
_____________________________ ERROR collecting pytest_trio/_tests/test_sync_fixture.py ______________________________
pytest_trio/_tests/test_sync_fixture.py:9: in <module>
???
/usr/lib/python3.8/site-packages/_pytest/mark/structures.py:513: in __getattr__
warnings.warn(
E pytest.PytestUnknownMarkWarning: Unknown pytest.mark.trio - is this a typo? You can register custom marks to avoid this warning - for details, see https://docs.pytest.org/en/stable/mark.html
This is the latest git master in an attempt to get the Alpine Linux package working again now pytest has been updated to 6.0.x
Metadata
Metadata
Assignees
Labels
No labels
Activity
altendky commentedon Sep 11, 2020
This is certainly not all locked down as I'm no Docker expert... but there's a
Dockerfileand output below that seem to work.tl;dr:
PYTHONPATH="." PYTEST_PLUGINS="pytest_trio.plugin" pytest --pyargs pytest_trioWall of text
PureTryOut commentedon Sep 11, 2020
Well this has nothing to do with Docker really, Alpine is used for more things 😉
I gave your command a shot and it failed, although differently:
Strange that it works on the Dockerfile, I don't really do anything different...
altendky commentedon Sep 11, 2020
Sorry for piling on with the ignorance there... and actually I recreated the same issue outside in my Ubuntu install.
Could you share the full command line and output anyways? Also include
python -m pip freezefor the Python that the pytest is running from. Andtype pythonandhead $(which pytest). Adjust all as needed so as to have them using the same Python. I'm looking to make sure pytest-trio isn't somehow installed now since the error sounds like it is and thePYTEST_PLUGINSis now redundant with the entry point plugin specification.Or... maybe just seeing more stuff will help my light bulb turn on.
hhartzer commentedon Dec 13, 2024
From what I can tell, pytest now refuses to run async tests without a marker, so it's not possible to use pytest-trio at the moment, with a recent pytest.
Or might I be mistaken about that?
altendky commentedon Dec 13, 2024
pytest has long had a feature where it complains about not-handled async tests. before they added that what happened was that it would execute the async call as a sync call, get a coroutine back, and consider the test passed since there was no exception. so you could easily get silent passes without running tests.
afaik, the documented mechanisms would generally be expected to work. more details would certainly be needed to debug the problem. given that we aren't clearly debugging the same situation, i would suggest a separate ticket be filed with all the details provided.