Skip to content

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

Closed

Conversation

elchupanebrej
Copy link

This address #466

@elchupanebrej elchupanebrej force-pushed the use_deselected_keyword branch from ea96d22 to 7d4f54b Compare January 2, 2022 01:14
@codecov
Copy link

codecov bot commented Jan 2, 2022

Codecov Report

Merging #470 (2e51390) into master (ddcbeb5) will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            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              
Impacted Files Coverage Δ
tests/feature/test_feature_base_dir.py 100.00% <100.00%> (ø)
tests/feature/test_steps.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ddcbeb5...2e51390. Read the comment docs.

@elchupanebrej
Copy link
Author

Let wait until pytest 7.0 release

Copy link
Member

@The-Compiler The-Compiler left a 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")
Copy link
Member

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).

Copy link
Author

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

@elchupanebrej elchupanebrej marked this pull request as draft January 6, 2022 22:24
@elchupanebrej elchupanebrej force-pushed the use_deselected_keyword branch from 7d4f54b to 2e51390 Compare March 4, 2022 09:48
@elchupanebrej
Copy link
Author

Closed because of #466

@elchupanebrej elchupanebrej deleted the use_deselected_keyword branch March 4, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants