Merge pull request #11326 from DetachHead/DetachHead-patch-1

use `if not TYPE_CHECKING` on `pytest.__getattr__` to prevent type checkers from using it
This commit is contained in:
Zac Hatfield-Dodds
2023-08-22 03:53:46 -07:00
committed by GitHub
2 changed files with 10 additions and 7 deletions

View File

@@ -272,7 +272,7 @@ def test_importing_instance_is_deprecated(pytester: Pytester) -> None:
pytest.PytestDeprecationWarning,
match=re.escape("The pytest.Instance collector type is deprecated"),
):
pytest.Instance
pytest.Instance # type:ignore[attr-defined]
with pytest.warns(
pytest.PytestDeprecationWarning,