Remove some type: ignores fixed in typeshed

This commit is contained in:
Ran Benita 2019-10-23 14:47:56 +03:00
parent 1787bffda0
commit 1cc1ac5183
3 changed files with 5 additions and 8 deletions

View File

@ -78,7 +78,8 @@ class AssertionRewritingHook(importlib.abc.MetaPathFinder):
# there's nothing to rewrite there
# python3.5 - python3.6: `namespace`
# python3.7+: `None`
or spec.origin in {None, "namespace"}
or spec.origin == "namespace"
or spec.origin is None
# we can only rewrite source files
or not isinstance(spec.loader, importlib.machinery.SourceFileLoader)
# if the file doesn't exist, we can't rewrite it
@ -743,8 +744,7 @@ class AssertionRewriter(ast.NodeVisitor):
from _pytest.warning_types import PytestAssertRewriteWarning
import warnings
# Ignore type: typeshed bug https://github.com/python/typeshed/pull/3121
warnings.warn_explicit( # type: ignore
warnings.warn_explicit(
PytestAssertRewriteWarning(
"assertion is always true, perhaps remove parentheses?"
),

View File

@ -368,9 +368,7 @@ class DoctestTextfile(pytest.Module):
)
parser = doctest.DocTestParser()
# Remove ignore once this reaches mypy:
# https://github.com/python/typeshed/commit/3e4a251b2b6da6bb43137acf5abf81ecfa7ba8ee
test = parser.get_doctest(text, globs, name, filename, 0) # type: ignore
test = parser.get_doctest(text, globs, name, filename, 0)
if test.examples:
yield DoctestItem(test.name, self, runner, test)

View File

@ -139,8 +139,7 @@ class Node:
)
)
path, lineno = get_fslocation_from_item(self)
# Type ignored: https://github.com/python/typeshed/pull/3121
warnings.warn_explicit( # type: ignore
warnings.warn_explicit(
warning,
category=None,
filename=str(path),