commit
d208c1d4a5
|
@ -52,7 +52,7 @@ from _pytest.pathlib import absolutepath
|
||||||
from _pytest.pathlib import bestrelpath
|
from _pytest.pathlib import bestrelpath
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 11):
|
if sys.version_info < (3, 11):
|
||||||
from exceptiongroup import BaseExceptionGroup
|
from exceptiongroup import BaseExceptionGroup
|
||||||
|
|
||||||
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
|
_TracebackStyle = Literal["long", "short", "line", "no", "native", "value", "auto"]
|
||||||
|
@ -703,7 +703,7 @@ class ExceptionInfo(Generic[E]):
|
||||||
# Workaround for https://github.com/python/cpython/issues/98778 on
|
# Workaround for https://github.com/python/cpython/issues/98778 on
|
||||||
# Python <= 3.9, and some 3.10 and 3.11 patch versions.
|
# Python <= 3.9, and some 3.10 and 3.11 patch versions.
|
||||||
HTTPError = getattr(sys.modules.get("urllib.error", None), "HTTPError", ())
|
HTTPError = getattr(sys.modules.get("urllib.error", None), "HTTPError", ())
|
||||||
if sys.version_info[:2] <= (3, 11) and isinstance(exc, HTTPError):
|
if sys.version_info < (3, 12) and isinstance(exc, HTTPError):
|
||||||
notes = []
|
notes = []
|
||||||
else:
|
else:
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -448,7 +448,7 @@ class MyOptionParser(argparse.ArgumentParser):
|
||||||
getattr(parsed, FILE_OR_DIR).extend(unrecognized)
|
getattr(parsed, FILE_OR_DIR).extend(unrecognized)
|
||||||
return parsed
|
return parsed
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 9): # pragma: no cover
|
if sys.version_info < (3, 9): # pragma: no cover
|
||||||
# Backport of https://github.com/python/cpython/pull/14316 so we can
|
# Backport of https://github.com/python/cpython/pull/14316 so we can
|
||||||
# disable long --argument abbreviations without breaking short flags.
|
# disable long --argument abbreviations without breaking short flags.
|
||||||
def _parse_optional(
|
def _parse_optional(
|
||||||
|
|
|
@ -69,7 +69,7 @@ from _pytest.scope import HIGH_SCOPES
|
||||||
from _pytest.scope import Scope
|
from _pytest.scope import Scope
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 11):
|
if sys.version_info < (3, 11):
|
||||||
from exceptiongroup import BaseExceptionGroup
|
from exceptiongroup import BaseExceptionGroup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -765,7 +765,7 @@ class Item(Node, abc.ABC):
|
||||||
and lineno is a 0-based line number.
|
and lineno is a 0-based line number.
|
||||||
"""
|
"""
|
||||||
location = self.reportinfo()
|
location = self.reportinfo()
|
||||||
path = absolutepath(os.fspath(location[0]))
|
path = absolutepath(location[0])
|
||||||
relfspath = self.session._node_location_to_relpath(path)
|
relfspath = self.session._node_location_to_relpath(path)
|
||||||
assert type(location[2]) is str
|
assert type(location[2]) is str
|
||||||
return (relfspath, location[1], location[2])
|
return (relfspath, location[1], location[2])
|
||||||
|
|
|
@ -924,13 +924,13 @@ def visit(
|
||||||
yield from visit(entry.path, recurse)
|
yield from visit(entry.path, recurse)
|
||||||
|
|
||||||
|
|
||||||
def absolutepath(path: Union[Path, str]) -> Path:
|
def absolutepath(path: "Union[str, os.PathLike[str]]") -> Path:
|
||||||
"""Convert a path to an absolute path using os.path.abspath.
|
"""Convert a path to an absolute path using os.path.abspath.
|
||||||
|
|
||||||
Prefer this over Path.resolve() (see #6523).
|
Prefer this over Path.resolve() (see #6523).
|
||||||
Prefer this over Path.absolute() (not public, doesn't normalize).
|
Prefer this over Path.absolute() (not public, doesn't normalize).
|
||||||
"""
|
"""
|
||||||
return Path(os.path.abspath(str(path)))
|
return Path(os.path.abspath(path))
|
||||||
|
|
||||||
|
|
||||||
def commonpath(path1: Path, path2: Path) -> Optional[Path]:
|
def commonpath(path1: Path, path2: Path) -> Optional[Path]:
|
||||||
|
|
|
@ -39,7 +39,7 @@ from _pytest.outcomes import Skipped
|
||||||
from _pytest.outcomes import TEST_OUTCOME
|
from _pytest.outcomes import TEST_OUTCOME
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 11):
|
if sys.version_info < (3, 11):
|
||||||
from exceptiongroup import BaseExceptionGroup
|
from exceptiongroup import BaseExceptionGroup
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
|
|
|
@ -28,7 +28,7 @@ import pytest
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from _pytest._code.code import _TracebackStyle
|
from _pytest._code.code import _TracebackStyle
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 11):
|
if sys.version_info < (3, 11):
|
||||||
from exceptiongroup import ExceptionGroup
|
from exceptiongroup import ExceptionGroup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ from _pytest.pytester import Pytester
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info[:2] < (3, 11):
|
if sys.version_info < (3, 11):
|
||||||
from exceptiongroup import ExceptionGroup
|
from exceptiongroup import ExceptionGroup
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1146,7 +1146,7 @@ def test_errors_in_xfail_skip_expressions(pytester: Pytester) -> None:
|
||||||
if pypy_version_info is not None and pypy_version_info < (6,):
|
if pypy_version_info is not None and pypy_version_info < (6,):
|
||||||
markline = markline[1:]
|
markline = markline[1:]
|
||||||
|
|
||||||
if sys.version_info[:2] >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
expected = [
|
expected = [
|
||||||
"*ERROR*test_nameerror*",
|
"*ERROR*test_nameerror*",
|
||||||
"*asd*",
|
"*asd*",
|
||||||
|
|
Loading…
Reference in New Issue