File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed
Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 11# PYTHON_ARGCOMPLETE_OK
22"""pytest: unit and functional testing with Python."""
3+ from typing import TYPE_CHECKING
4+
35from _pytest import __version__
46from _pytest import version_tuple
57from _pytest ._code import ExceptionInfo
165167 "yield_fixture" ,
166168]
167169
170+ if not TYPE_CHECKING :
168171
169- def __getattr__ (name : str ) -> object :
170- if name == "Instance" :
171- # The import emits a deprecation warning.
172- from _pytest .python import Instance
172+ def __getattr__ (name : str ) -> object :
173+ if name == "Instance" :
174+ # The import emits a deprecation warning.
175+ from _pytest .python import Instance
173176
174- return Instance
175- raise AttributeError (f"module { __name__ } has no attribute { name } " )
177+ return Instance
178+ raise AttributeError (f"module { __name__ } has no attribute { name } " )
Original file line number Diff line number Diff line change @@ -272,7 +272,7 @@ def test_importing_instance_is_deprecated(pytester: Pytester) -> None:
272272 pytest .PytestDeprecationWarning ,
273273 match = re .escape ("The pytest.Instance collector type is deprecated" ),
274274 ):
275- pytest .Instance
275+ pytest .Instance # type:ignore[attr-defined]
276276
277277 with pytest .warns (
278278 pytest .PytestDeprecationWarning ,
You can’t perform that action at this time.
0 commit comments