Skip to content

Commit 153ba65

Browse files
pabs3Michael Howitz
authored andcommitted
Check errors outcome field
Use the right field depending on the pytest version, pytest before 6.0 uses singular, later uses plural. Reported-by: vulture
1 parent e9397e9 commit 153ba65

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

test_pytest_rerunfailures.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
pytest_plugins = "pytester"
1010

11+
PYTEST_GTE_60 = pkg_resources.parse_version(
12+
pytest.__version__
13+
) >= pkg_resources.parse_version("6.0")
14+
1115
PYTEST_GTE_61 = pkg_resources.parse_version(
1216
pytest.__version__
1317
) >= pkg_resources.parse_version("6.1")
@@ -45,6 +49,8 @@ def assert_outcomes(
4549
check_outcome_field(outcomes, "passed", passed)
4650
check_outcome_field(outcomes, "skipped", skipped)
4751
check_outcome_field(outcomes, "failed", failed)
52+
field = "errors" if PYTEST_GTE_60 else "error"
53+
check_outcome_field(outcomes, field, error)
4854
check_outcome_field(outcomes, "xfailed", xfailed)
4955
check_outcome_field(outcomes, "xpassed", xpassed)
5056
check_outcome_field(outcomes, "rerun", rerun)

0 commit comments

Comments
 (0)