[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
0dd682fc2b
commit
894aa333a7
|
@ -274,7 +274,6 @@ class AssertionRewritingHook(importlib.abc.MetaPathFinder, importlib.abc.Loader)
|
|||
return f.read()
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
from importlib.resources.abc import TraversableResources
|
||||
else:
|
||||
|
|
|
@ -62,7 +62,6 @@ from _pytest.warning_types import PytestConfigWarning
|
|||
from _pytest.warning_types import warn_explicit_for
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
from _pytest._code.code import _TracebackStyle
|
||||
from _pytest.terminal import TerminalReporter
|
||||
from .argparsing import Argument
|
||||
|
@ -1067,7 +1066,6 @@ class Config:
|
|||
try:
|
||||
self.parse(args)
|
||||
except UsageError:
|
||||
|
||||
# Handle --version and --help here in a minimal fashion.
|
||||
# This gets done via helpconfig normally, but its
|
||||
# pytest_cmdline_main is not called in case of errors.
|
||||
|
|
|
@ -43,7 +43,6 @@ class PathAwareHookProxy:
|
|||
|
||||
@_wraps(hook)
|
||||
def fixed_hook(**kw):
|
||||
|
||||
path_value: Optional[Path] = kw.pop(path_var, None)
|
||||
fspath_value: Optional[LEGACY_PATH] = kw.pop(fspath_var, None)
|
||||
if fspath_value is not None:
|
||||
|
|
|
@ -531,7 +531,6 @@ class DoctestModule(Module):
|
|||
if _is_mocked(obj):
|
||||
return
|
||||
with _patch_unwrap_mock_aware():
|
||||
|
||||
# Type ignored because this is a private function.
|
||||
super()._find( # type:ignore[misc]
|
||||
tests, obj, name, module, source_lines, globs, seen
|
||||
|
|
|
@ -219,7 +219,6 @@ def _resolve_msg_to_reason(
|
|||
"""
|
||||
__tracebackhide__ = True
|
||||
if msg is not None:
|
||||
|
||||
if reason:
|
||||
from pytest import UsageError
|
||||
|
||||
|
|
|
@ -789,7 +789,8 @@ def _call_with_optional_argument(func, arg) -> None:
|
|||
|
||||
def _get_first_non_fixture_func(obj: object, names: Iterable[str]) -> Optional[object]:
|
||||
"""Return the attribute from the given object to be used as a setup/teardown
|
||||
xunit-style function, but only if not marked as a fixture to avoid calling it twice."""
|
||||
xunit-style function, but only if not marked as a fixture to avoid calling it twice.
|
||||
"""
|
||||
for name in names:
|
||||
meth: Optional[object] = getattr(obj, name, None)
|
||||
if meth is not None and fixtures.getfixturemarker(meth) is None:
|
||||
|
|
|
@ -572,7 +572,6 @@ def _report_kwargs_from_json(reportdict: Dict[str, Any]) -> Dict[str, Any]:
|
|||
and "reprcrash" in reportdict["longrepr"]
|
||||
and "reprtraceback" in reportdict["longrepr"]
|
||||
):
|
||||
|
||||
reprtraceback = deserialize_repr_traceback(
|
||||
reportdict["longrepr"]["reprtraceback"]
|
||||
)
|
||||
|
|
|
@ -871,7 +871,6 @@ class TestDurations:
|
|||
)
|
||||
|
||||
def test_calls_show_2(self, pytester: Pytester, mock_timing) -> None:
|
||||
|
||||
pytester.makepyfile(self.source)
|
||||
result = pytester.runpytest_inprocess("--durations=2")
|
||||
assert result.ret == 0
|
||||
|
|
|
@ -494,7 +494,6 @@ class TestLastFailed:
|
|||
def test_lastfailed_collectfailure(
|
||||
self, pytester: Pytester, monkeypatch: MonkeyPatch
|
||||
) -> None:
|
||||
|
||||
pytester.makepyfile(
|
||||
test_maybe="""
|
||||
import os
|
||||
|
|
|
@ -1236,7 +1236,6 @@ class TestDoctestSkips:
|
|||
|
||||
|
||||
class TestDoctestAutoUseFixtures:
|
||||
|
||||
SCOPES = ["module", "session", "class", "function"]
|
||||
|
||||
def test_doctest_module_session_fixture(self, pytester: Pytester):
|
||||
|
@ -1379,7 +1378,6 @@ class TestDoctestAutoUseFixtures:
|
|||
|
||||
|
||||
class TestDoctestNamespaceFixture:
|
||||
|
||||
SCOPES = ["module", "session", "class", "function"]
|
||||
|
||||
@pytest.mark.parametrize("scope", SCOPES)
|
||||
|
|
|
@ -253,7 +253,6 @@ class TestPython:
|
|||
duration_report: str,
|
||||
run_and_parse: RunAndParse,
|
||||
) -> None:
|
||||
|
||||
# mock LogXML.node_reporter so it always sets a known duration to each test report object
|
||||
original_node_reporter = LogXML.node_reporter
|
||||
|
||||
|
@ -603,7 +602,6 @@ class TestPython:
|
|||
node.assert_attr(failures=3, tests=3)
|
||||
|
||||
for index, char in enumerate("<&'"):
|
||||
|
||||
tnode = node.find_nth_by_tag("testcase", index)
|
||||
tnode.assert_attr(
|
||||
classname="test_failure_escape", name="test_func[%s]" % char
|
||||
|
|
|
@ -906,6 +906,7 @@ def test_makereport_getsource_dynamic_code(
|
|||
def test_store_except_info_on_error() -> None:
|
||||
"""Test that upon test failure, the exception info is stored on
|
||||
sys.last_traceback and friends."""
|
||||
|
||||
# Simulate item that might raise a specific exception, depending on `raise_error` class var
|
||||
class ItemMightRaise:
|
||||
nodeid = "item_that_raises"
|
||||
|
|
Loading…
Reference in New Issue