Skip to content

Commit 1cc1ac5

Browse files
committed
Remove some type: ignores fixed in typeshed
1 parent 1787bff commit 1cc1ac5

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

src/_pytest/assertion/rewrite.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ def find_spec(self, name, path=None, target=None):
7878
# there's nothing to rewrite there
7979
# python3.5 - python3.6: `namespace`
8080
# python3.7+: `None`
81-
or spec.origin in {None, "namespace"}
81+
or spec.origin == "namespace"
82+
or spec.origin is None
8283
# we can only rewrite source files
8384
or not isinstance(spec.loader, importlib.machinery.SourceFileLoader)
8485
# if the file doesn't exist, we can't rewrite it
@@ -743,8 +744,7 @@ def visit_Assert(self, assert_):
743744
from _pytest.warning_types import PytestAssertRewriteWarning
744745
import warnings
745746

746-
# Ignore type: typeshed bug https://github.com/python/typeshed/pull/3121
747-
warnings.warn_explicit( # type: ignore
747+
warnings.warn_explicit(
748748
PytestAssertRewriteWarning(
749749
"assertion is always true, perhaps remove parentheses?"
750750
),

src/_pytest/doctest.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,7 @@ def collect(self):
368368
)
369369

370370
parser = doctest.DocTestParser()
371-
# Remove ignore once this reaches mypy:
372-
# https://github.com/python/typeshed/commit/3e4a251b2b6da6bb43137acf5abf81ecfa7ba8ee
373-
test = parser.get_doctest(text, globs, name, filename, 0) # type: ignore
371+
test = parser.get_doctest(text, globs, name, filename, 0)
374372
if test.examples:
375373
yield DoctestItem(test.name, self, runner, test)
376374

src/_pytest/nodes.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ def warn(self, warning):
139139
)
140140
)
141141
path, lineno = get_fslocation_from_item(self)
142-
# Type ignored: https://github.com/python/typeshed/pull/3121
143-
warnings.warn_explicit( # type: ignore
142+
warnings.warn_explicit(
144143
warning,
145144
category=None,
146145
filename=str(path),

0 commit comments

Comments
 (0)