diff options
author | Ran Benita <ran@unusedvar.com> | 2020-08-03 19:15:21 +0300 |
---|---|---|
committer | Ran Benita <ran@unusedvar.com> | 2020-08-04 09:59:46 +0300 |
commit | 9ab14c6d9cc8318f62d14e0c49ca37a13972bd0e (patch) | |
tree | 2f8d1153454591e2e5d284d92b5bb996a00f488d /src/_pytest/pathlib.py | |
parent | 0dd5e169d0cfab2bee64fb6f463449d9347c489a (diff) | |
download | pytest-9ab14c6d9cc8318f62d14e0c49ca37a13972bd0e.tar.gz |
typing: set warn_unreachable
This makes mypy raise an error whenever it detects code which is
statically unreachable, e.g.
x: int
if isinstance(x, str):
... # Statement is unreachable [unreachable]
This is really neat and finds quite a few logic and typing bugs.
Sometimes the code is intentionally unreachable in terms of types, e.g.
raising TypeError when a function is given an argument with a wrong
type. In these cases a `type: ignore[unreachable]` is needed, but I
think it's a nice code hint.
Diffstat (limited to 'src/_pytest/pathlib.py')
-rw-r--r-- | src/_pytest/pathlib.py | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/src/_pytest/pathlib.py b/src/_pytest/pathlib.py index ea263be70..b3129020d 100644 --- a/src/_pytest/pathlib.py +++ b/src/_pytest/pathlib.py @@ -367,7 +367,6 @@ def make_numbered_dir_with_cleanup( def resolve_from_str(input: str, root: py.path.local) -> Path: - assert not isinstance(input, Path), "would break on py2" rootpath = Path(root) input = expanduser(input) input = expandvars(input) |