Skip to content

Commit 8b54596

Browse files
committed
Run pre-commit on all files
Running pre-commit on all files after replacing reorder-python-imports by isort.
1 parent 899a6cf commit 8b54596

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+133
-142
lines changed

bench/bench.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
if __name__ == "__main__":
44
import cProfile
5-
import pytest # NOQA
65
import pstats
76

7+
import pytest # NOQA
8+
89
script = sys.argv[1:] if len(sys.argv) > 1 else ["empty.py"]
910
cProfile.run("pytest.cmdline.main(%r)" % script, "prof")
1011
p = pstats.Stats("prof")

doc/en/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,10 @@
440440

441441
def configure_logging(app: "sphinx.application.Sphinx") -> None:
442442
"""Configure Sphinx's WarningHandler to handle (expected) missing include."""
443-
import sphinx.util.logging
444443
import logging
445444

445+
import sphinx.util.logging
446+
446447
class WarnLogFilter(logging.Filter):
447448
def filter(self, record: logging.LogRecord) -> bool:
448449
"""Ignore warnings about missing include with "only" directive.

doc/en/example/multipython.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""Module containing a parametrized tests testing cross-python serialization
22
via the pickle module."""
3+
34
import shutil
45
import subprocess
56
import textwrap
67

78
import pytest
89

9-
1010
pythonlist = ["python3.9", "python3.10", "python3.11"]
1111

1212

scripts/update-plugin-list.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
from requests_cache import SQLiteCache
2020
from tqdm import tqdm
2121

22-
2322
FILE_HEAD = r"""
2423
.. Note this file is autogenerated by scripts/update-plugin-list.py - usually weekly via github action
2524

src/_pytest/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
__all__ = ["__version__", "version_tuple"]
22

33
try:
4-
from ._version import version as __version__, version_tuple
4+
from ._version import version as __version__
5+
from ._version import version_tuple
56
except ImportError: # pragma: no cover
67
# broken installation, we don't even try
78
# unknown only works because we do poor mans version compare

src/_pytest/_argcomplete.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
which should throw a KeyError: 'COMPLINE' (which is properly set by the
6262
global argcomplete script).
6363
"""
64+
6465
import argparse
6566
import os
6667
import sys

src/_pytest/_code/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Python inspection/code generation API."""
2+
23
from .code import Code
34
from .code import ExceptionInfo
45
from .code import filter_traceback

src/_pytest/_code/code.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,9 @@ def ishidden(self, excinfo: Optional["ExceptionInfo[BaseException]"]) -> bool:
278278
279279
Mostly for internal use.
280280
"""
281-
tbh: Union[
282-
bool, Callable[[Optional[ExceptionInfo[BaseException]]], bool]
283-
] = False
281+
tbh: Union[bool, Callable[[Optional[ExceptionInfo[BaseException]]], bool]] = (
282+
False
283+
)
284284
for maybe_ns_dct in (self.frame.f_locals, self.frame.f_globals):
285285
# in normal cases, f_locals and f_globals are dictionaries
286286
# however via `exec(...)` / `eval(...)` they can be other types
@@ -377,12 +377,10 @@ def cut(
377377
return self
378378

379379
@overload
380-
def __getitem__(self, key: "SupportsIndex") -> TracebackEntry:
381-
...
380+
def __getitem__(self, key: "SupportsIndex") -> TracebackEntry: ...
382381

383382
@overload
384-
def __getitem__(self, key: slice) -> "Traceback":
385-
...
383+
def __getitem__(self, key: slice) -> "Traceback": ...
386384

387385
def __getitem__(
388386
self, key: Union["SupportsIndex", slice]
@@ -1056,13 +1054,13 @@ def repr_excinfo(
10561054
# full support for exception groups added to ExceptionInfo.
10571055
# See https://github.com/pytest-dev/pytest/issues/9159
10581056
if isinstance(e, BaseExceptionGroup):
1059-
reprtraceback: Union[
1060-
ReprTracebackNative, ReprTraceback
1061-
] = ReprTracebackNative(
1062-
traceback.format_exception(
1063-
type(excinfo_.value),
1064-
excinfo_.value,
1065-
excinfo_.traceback[0]._rawentry,
1057+
reprtraceback: Union[ReprTracebackNative, ReprTraceback] = (
1058+
ReprTracebackNative(
1059+
traceback.format_exception(
1060+
type(excinfo_.value),
1061+
excinfo_.value,
1062+
excinfo_.traceback[0]._rawentry,
1063+
)
10661064
)
10671065
)
10681066
else:

src/_pytest/_code/source.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ def __eq__(self, other: object) -> bool:
4747
__hash__ = None # type: ignore
4848

4949
@overload
50-
def __getitem__(self, key: int) -> str:
51-
...
50+
def __getitem__(self, key: int) -> str: ...
5251

5352
@overload
54-
def __getitem__(self, key: slice) -> "Source":
55-
...
53+
def __getitem__(self, key: slice) -> "Source": ...
5654

5755
def __getitem__(self, key: Union[int, slice]) -> Union[str, "Source"]:
5856
if isinstance(key, int):

src/_pytest/_io/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from .terminalwriter import get_terminal_width
22
from .terminalwriter import TerminalWriter
33

4-
54
__all__ = [
65
"TerminalWriter",
76
"get_terminal_width",

0 commit comments

Comments
 (0)