Closed jayvdb closed 7 years ago
I have a workaround coming, and probably a fix also.
So the workaround is to not add command line option --reqs
, but instead create a tests/conftest.py
with the following:
from pytest_reqs import pytest_collection_modifyitems as _modifyitems
def pytest_collection_modifyitems(config, session, items):
config.option.reqs = True
_modifyitems(config, session, items)
config.option.reqs = False
This loads them first, as conftest.py
is the first 'plugin'. All other plugins are rather random (see https://github.com/pytest-dev/pytest/issues/935).
Hey @jayvdb, thanks for the bug report. Like you mentioned, it's not currently possible for pytest-reqs
to enforce any sort of precedence with regards to other plugins.
Your solution is great though. I just made #10 to make this a little cleaner to do, and add some docs about it for anyone else that would like the same behavior.
Note that #10 doesnt really solve this issue, even with the modified conftest.py trick. The requirements checks are still placed last. But since the tests are added in conftest.py, before other plugins, pytest-reorder can see and reorder them.
pytest-reqs adds the new checks at the end, so they run last. They should be run before other tests, as the requirement failures will explain any other failures that are related to the versions of dependencies.