Skip to content

Commit

Permalink
python 3.11 fixes: enum repr changed
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile authored and nicoddemus committed Feb 11, 2022
1 parent 5076792 commit 316090e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 4 additions & 1 deletion testing/python/metafunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,10 @@ def test_idmaker_enum(self) -> None:
result = IdMaker(
("a", "b"), [pytest.param(e.one, e.two)], None, None, None, None
).make_unique_parameterset_ids()
assert result == ["Foo.one-Foo.two"]
if sys.version_info >= (3, 11):
assert result == ["one-two"]
else:
assert result == ["Foo.one-Foo.two"]

def test_idmaker_idfn(self) -> None:
"""#351"""
Expand Down
14 changes: 10 additions & 4 deletions testing/test_pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,10 +743,16 @@ def test_run_result_repr() -> None:

# known exit code
r = pytester_mod.RunResult(1, outlines, errlines, duration=0.5)
assert (
repr(r) == "<RunResult ret=ExitCode.TESTS_FAILED len(stdout.lines)=3"
" len(stderr.lines)=4 duration=0.50s>"
)
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>"
)

# unknown exit code: just the number
r = pytester_mod.RunResult(99, outlines, errlines, duration=0.5)
Expand Down

0 comments on commit 316090e

Please sign in to comment.