python 3.11 fixes: enum repr changed

This commit is contained in:
Anthony Sottile 2022-01-23 13:52:44 -05:00 committed by Bruno Oliveira
parent 5076792b71
commit 316090eb5c
2 changed files with 14 additions and 5 deletions

View File

@ -488,6 +488,9 @@ class TestMetafunc:
result = IdMaker(
("a", "b"), [pytest.param(e.one, e.two)], None, None, None, None
).make_unique_parameterset_ids()
if sys.version_info >= (3, 11):
assert result == ["one-two"]
else:
assert result == ["Foo.one-Foo.two"]
def test_idmaker_idfn(self) -> None:

View File

@ -743,6 +743,12 @@ def test_run_result_repr() -> None:
# known exit code
r = pytester_mod.RunResult(1, outlines, errlines, duration=0.5)
if sys.version_info >= (3, 11):
assert (
repr(r) == "<RunResult ret=TESTS_FAILED len(stdout.lines)=3"
" len(stderr.lines)=4 duration=0.50s>"
)
else:
assert (
repr(r) == "<RunResult ret=ExitCode.TESTS_FAILED len(stdout.lines)=3"
" len(stderr.lines)=4 duration=0.50s>"