testing: remove conditionals for Python 3.11 beta releases

No need to support beta releases of an older version anymore.

Ref: 09b2c95320
This commit is contained in:
Ran Benita 2024-05-17 11:22:53 +03:00
parent ee9ea703f9
commit dbee3fa34a
2 changed files with 1 additions and 22 deletions

View File

@ -1,7 +1,6 @@
# mypy: allow-untyped-defs # mypy: allow-untyped-defs
import inspect import inspect
from pathlib import Path from pathlib import Path
import sys
import textwrap import textwrap
from typing import Callable from typing import Callable
from typing import Optional from typing import Optional
@ -224,11 +223,6 @@ class TestDoctests:
"Traceback (most recent call last):", "Traceback (most recent call last):",
' File "*/doctest.py", line *, in __run', ' File "*/doctest.py", line *, in __run',
" *", " *",
*(
(" *^^^^*",)
if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else ()
),
' File "<doctest test_doctest_unexpected_exception.txt[1]>", line 1, in <module>', ' File "<doctest test_doctest_unexpected_exception.txt[1]>", line 1, in <module>',
"ZeroDivisionError: division by zero", "ZeroDivisionError: division by zero",
"*/test_doctest_unexpected_exception.txt:2: UnexpectedException", "*/test_doctest_unexpected_exception.txt:2: UnexpectedException",

View File

@ -3,7 +3,6 @@ import argparse
import os import os
from pathlib import Path from pathlib import Path
import re import re
import sys
from typing import Optional from typing import Optional
from _pytest.config import ExitCode from _pytest.config import ExitCode
@ -45,32 +44,18 @@ def test_wrap_session_notify_exception(ret_exc, pytester: Pytester) -> None:
assert result.ret == ExitCode.INTERNAL_ERROR assert result.ret == ExitCode.INTERNAL_ERROR
assert result.stdout.lines[0] == "INTERNALERROR> Traceback (most recent call last):" assert result.stdout.lines[0] == "INTERNALERROR> Traceback (most recent call last):"
end_lines = ( end_lines = result.stdout.lines[-3:]
result.stdout.lines[-4:]
if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else result.stdout.lines[-3:]
)
if exc == SystemExit: if exc == SystemExit:
assert end_lines == [ assert end_lines == [
f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart',
'INTERNALERROR> raise SystemExit("boom")', 'INTERNALERROR> raise SystemExit("boom")',
*(
("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",)
if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else ()
),
"INTERNALERROR> SystemExit: boom", "INTERNALERROR> SystemExit: boom",
] ]
else: else:
assert end_lines == [ assert end_lines == [
f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart', f'INTERNALERROR> File "{c1}", line 4, in pytest_sessionstart',
'INTERNALERROR> raise ValueError("boom")', 'INTERNALERROR> raise ValueError("boom")',
*(
("INTERNALERROR> ^^^^^^^^^^^^^^^^^^^^^^^^",)
if (3, 11, 0, "beta", 4) > sys.version_info >= (3, 11)
else ()
),
"INTERNALERROR> ValueError: boom", "INTERNALERROR> ValueError: boom",
] ]
if returncode is False: if returncode is False: