Use TYPE_CHECKING instead of False

This allows for e.g. Jedi to infer types (it checks the name).

It was only used to support Python 3.5.0/3.5.1, where this is is not
available in the `typing` module.

Ref: https://github.com/davidhalter/jedi/issues/1472

Uses `TYPE_CHECKING = False` in `_pytest.outcomes` to avoid having to
work around circular import.
This commit is contained in:
Daniel Hahler
2020-01-10 19:53:57 +01:00
parent 715f56dfbc
commit 4630e2725e
15 changed files with 37 additions and 15 deletions

View File

@@ -23,9 +23,10 @@ from more_itertools.more import always_iterable
import _pytest._code
from _pytest.compat import overload
from _pytest.compat import STRING_TYPES
from _pytest.compat import TYPE_CHECKING
from _pytest.outcomes import fail
if False: # TYPE_CHECKING
if TYPE_CHECKING:
from typing import Type # noqa: F401 (used in type string)