You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to specify a pytest version dependency, so new versions of a plugin support pytest 6, while if pytest 5 is around, a previous version of the plugin is used?
I know this is more of a Python dependency management thing. But since pytest relies on and welcomes the plugin community, this seems like it should be documented in the "writing plugins" section.
I'm checking to see if pytest 6.0.0rc1 is compatible with a plugin I support, pytest-check.
Well, it's not, because:
The internal structure of how xfail works has changed.
pytest.skipping.evalxfail_key changed to xfailed_key
item._store[evalxfail_key], now item._store[xfailed_key] no longer has wasvalid() or istrue() methods.
.getexplanation() changed to .reason
taking my que from pytest_runtest_call from skipping.py to figure out how to interact with xfail data structure.
For pytester, assert_outcomes() change from "error" to "errors" as keywords.
That's fair enough, kinda, it's a new major version, and breaking changes are allowed.
I've already worked through the necessary changes, but it definitely won't work now with older versions of pytest.
So, what is the recommendation for plugin authors to have a plugin depend on a min version of pytest.
Does normal min/max dependency stuff in packaging work?
output of pip list from the virtual environment you are using
Also, is there a way to check the version of pytest at runtime to use as a behavior switch?
okken
changed the title
How to have a pytest plugin depend on a version of pytest?
pytest 6: How to have a pytest plugin depend on a version of pytest?
Jul 18, 2020
Does normal min/max dependency stuff in packaging work?
Yep, install_requires=["pytest>=6.0.0", ...] in your plugin's setup.py (or whatever packaging tool you prefer) will do the usual thing.
Personally I also add a runtime check on pytest.__version__ though, because pip is still quite capable of installing package versions that don't work togther - for example by installing your plugin and then downgrading pytest afterwards. The ongoing resolver project should help with that, but something like this is IMO still worth having.
Is there a way to specify a pytest version dependency, so new versions of a plugin support pytest 6, while if pytest 5 is around, a previous version of the plugin is used?
I know this is more of a Python dependency management thing. But since pytest relies on and welcomes the plugin community, this seems like it should be documented in the "writing plugins" section.
I'm checking to see if pytest 6.0.0rc1 is compatible with a plugin I support, pytest-check.
Well, it's not, because:
pytest.skipping.evalxfail_key
changed toxfailed_key
item._store[evalxfail_key]
, nowitem._store[xfailed_key]
no longer haswasvalid()
oristrue()
methods..getexplanation()
changed to.reason
pytest_runtest_call
fromskipping.py
to figure out how to interact with xfail data structure.That's fair enough, kinda, it's a new major version, and breaking changes are allowed.
I've already worked through the necessary changes, but it definitely won't work now with older versions of pytest.
So, what is the recommendation for plugin authors to have a plugin depend on a min version of pytest.
Does normal min/max dependency stuff in packaging work?
pip list
from the virtual environment you are usingpytest 6.0.0rc1, macOS 10.15.5 (19F101), Darwin 19.5.0
The text was updated successfully, but these errors were encountered: