-
Notifications
You must be signed in to change notification settings - Fork 226
Fix "deselect" keyword usage by pytester.assert_outcomes for pytest>6 #470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix "deselect" keyword usage by pytester.assert_outcomes for pytest>6 #470
Conversation
ea96d22
to
7d4f54b
Compare
Codecov Report
@@ Coverage Diff @@
## master #470 +/- ##
==========================================
+ Coverage 95.40% 95.46% +0.05%
==========================================
Files 48 48
Lines 1566 1586 +20
Branches 166 174 +8
==========================================
+ Hits 1494 1514 +20
Misses 45 45
Partials 27 27
Continue to review full report at Codecov.
|
Let wait until pytest 7.0 release |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I opened a discussion about this on the pytest side too: pytest-dev/pytest#9471
If we decide to stick with the change (likely, I think), having a single assert_outcomes
helper function might lead to cleaner code than having if's scattered everywhere.
Also note that pkg_resources
is discouraged, I added a comment about it.
import pytest | ||
|
||
NOT_EXISTING_FEATURE_PATHS = [".", "/does/not/exist/"] | ||
|
||
assert_outcomes_extra = pkg_resources.get_distribution("pytest").parsed_version >= pkg_resources.parse_version("7.0.0") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that pkg_resources
is a third-party dependency (part of setuptools
, but not the stdlib), and is officially discouraged:
Use of pkg_resources is discouraged in favor of importlib.resources, importlib.metadata, and their backports (resources, metadata). Please consider using those libraries instead of pkg_resources.
Note that importlib.metadata
also only was added in Python 3.8. However, pytest 7 added pytest.version_tuple
, so you could get the version from there (and assume False
when it does not exist).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest_bdd supports pytest<7 and python=3.7, so for now - this is not an option
7d4f54b
to
2e51390
Compare
Closed because of #466 |
This address #466