Skip to content

Commit 3392be3

Browse files
committed
Fix check_untyped_defs in test_runner
1 parent 3d2680b commit 3392be3

File tree

2 files changed

+103
-75
lines changed

2 files changed

+103
-75
lines changed

src/_pytest/reports.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from io import StringIO
22
from pprint import pprint
3+
from typing import Any
34
from typing import List
45
from typing import Optional
56
from typing import Tuple
@@ -17,6 +18,7 @@
1718
from _pytest._code.code import ReprLocals
1819
from _pytest._code.code import ReprTraceback
1920
from _pytest._code.code import TerminalRepr
21+
from _pytest.compat import TYPE_CHECKING
2022
from _pytest.nodes import Node
2123
from _pytest.outcomes import skip
2224
from _pytest.pathlib import Path
@@ -41,9 +43,14 @@ class BaseReport:
4143
sections = [] # type: List[Tuple[str, str]]
4244
nodeid = None # type: str
4345

44-
def __init__(self, **kw):
46+
def __init__(self, **kw: Any) -> None:
4547
self.__dict__.update(kw)
4648

49+
if TYPE_CHECKING:
50+
# Can have arbitrary fields given to __init__().
51+
def __getattr__(self, key: str) -> Any:
52+
raise NotImplementedError()
53+
4754
def toterminal(self, out) -> None:
4855
if hasattr(self, "node"):
4956
out.line(getslaveinfoline(self.node)) # type: ignore

0 commit comments

Comments
 (0)