summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2021-01-29 20:40:43 +0200
committerRan Benita <ran@unusedvar.com>2021-01-29 20:40:43 +0200
commitafea19079786761ee167e2bb4e0c90e3f44ba544 (patch)
tree1c3713bc71ca78096e9ac5ae821ea92c7c84bae5 /src
parent07f0eb26b4da671659fefbfcce59d5d56e91f21a (diff)
downloadpytest-afea19079786761ee167e2bb4e0c90e3f44ba544.tar.gz
Remove some no longer needed type-ignores
Diffstat (limited to 'src')
-rwxr-xr-xsrc/_pytest/cacheprovider.py2
-rw-r--r--src/_pytest/monkeypatch.py2
-rw-r--r--src/_pytest/pytester.py10
-rw-r--r--src/_pytest/python.py3
-rw-r--r--src/_pytest/python_api.py2
5 files changed, 7 insertions, 12 deletions
diff --git a/src/_pytest/cacheprovider.py b/src/_pytest/cacheprovider.py
index 480319c03..585cebf6c 100755
--- a/src/_pytest/cacheprovider.py
+++ b/src/_pytest/cacheprovider.py
@@ -415,7 +415,7 @@ class NFPlugin:
self.cached_nodeids.update(item.nodeid for item in items)
def _get_increasing_order(self, items: Iterable[nodes.Item]) -> List[nodes.Item]:
- return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True) # type: ignore[no-any-return]
+ return sorted(items, key=lambda item: item.fspath.mtime(), reverse=True)
def pytest_sessionfinish(self) -> None:
config = self.config
diff --git a/src/_pytest/monkeypatch.py b/src/_pytest/monkeypatch.py
index ffef87173..2c4320656 100644
--- a/src/_pytest/monkeypatch.py
+++ b/src/_pytest/monkeypatch.py
@@ -91,7 +91,7 @@ def annotated_getattr(obj: object, name: str, ann: str) -> object:
def derive_importpath(import_path: str, raising: bool) -> Tuple[str, object]:
- if not isinstance(import_path, str) or "." not in import_path: # type: ignore[unreachable]
+ if not isinstance(import_path, str) or "." not in import_path:
raise TypeError(f"must be absolute import path string, not {import_path!r}")
module, attr = import_path.rsplit(".", 1)
target = resolve(module)
diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py
index d428654de..4fe6e288b 100644
--- a/src/_pytest/pytester.py
+++ b/src/_pytest/pytester.py
@@ -1096,7 +1096,7 @@ class Pytester:
class reprec: # type: ignore
pass
- reprec.ret = ret # type: ignore
+ reprec.ret = ret
# Typically we reraise keyboard interrupts from the child run
# because it's our user requesting interruption of the testing.
@@ -1263,9 +1263,7 @@ class Pytester:
Whether to also write an ``__init__.py`` file to the same
directory to ensure it is a package.
"""
- # TODO: Remove type ignore in next mypy release (> 0.790).
- # https://github.com/python/typeshed/pull/4582
- if isinstance(source, os.PathLike): # type: ignore[misc]
+ if isinstance(source, os.PathLike):
path = self.path.joinpath(source)
assert not withinit, "not supported for paths"
else:
@@ -1367,10 +1365,8 @@ class Pytester:
"""
__tracebackhide__ = True
- # TODO: Remove type ignore in next mypy release.
- # https://github.com/python/typeshed/pull/4582
cmdargs = tuple(
- os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs # type: ignore[misc]
+ os.fspath(arg) if isinstance(arg, os.PathLike) else arg for arg in cmdargs
)
p1 = self.path.joinpath("stdout")
p2 = self.path.joinpath("stderr")
diff --git a/src/_pytest/python.py b/src/_pytest/python.py
index 29ebd176b..3d903ff9b 100644
--- a/src/_pytest/python.py
+++ b/src/_pytest/python.py
@@ -139,8 +139,7 @@ def pytest_cmdline_main(config: Config) -> Optional[Union[int, ExitCode]]:
def pytest_generate_tests(metafunc: "Metafunc") -> None:
for marker in metafunc.definition.iter_markers(name="parametrize"):
- # TODO: Fix this type-ignore (overlapping kwargs).
- metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker) # type: ignore[misc]
+ metafunc.parametrize(*marker.args, **marker.kwargs, _param_mark=marker)
def pytest_configure(config: Config) -> None:
diff --git a/src/_pytest/python_api.py b/src/_pytest/python_api.py
index 81ce4f895..7e0c86479 100644
--- a/src/_pytest/python_api.py
+++ b/src/_pytest/python_api.py
@@ -713,7 +713,7 @@ def raises(
else:
excepted_exceptions = expected_exception
for exc in excepted_exceptions:
- if not isinstance(exc, type) or not issubclass(exc, BaseException): # type: ignore[unreachable]
+ if not isinstance(exc, type) or not issubclass(exc, BaseException):
msg = "expected exception must be a BaseException type, not {}" # type: ignore[unreachable]
not_a = exc.__name__ if isinstance(exc, type) else type(exc).__name__
raise TypeError(msg.format(not_a))