Fix wrong location of assertion error with coverage.py

Reverts using-constant part from 39ba99613.

Fixes https://github.com/pytest-dev/pytest/issues/5754.
This commit is contained in:
Daniel Hahler
2019-08-17 19:45:44 +02:00
parent c3a8e609f9
commit 05bfe73cf9
2 changed files with 21 additions and 4 deletions
+1 -4
View File
@@ -33,9 +33,6 @@ PYTEST_TAG = "{}-pytest-{}".format(sys.implementation.cache_tag, version)
PYC_EXT = ".py" + (__debug__ and "c" or "o")
PYC_TAIL = "." + PYTEST_TAG + PYC_EXT
AST_IS = ast.Is()
AST_NONE = ast.NameConstant(None)
class AssertionRewritingHook:
"""PEP302/PEP451 import hook which rewrites asserts."""
@@ -857,7 +854,7 @@ class AssertionRewriter(ast.NodeVisitor):
internally already.
See issue #3191 for more details.
"""
val_is_none = ast.Compare(node, [AST_IS], [AST_NONE])
val_is_none = ast.Compare(node, [ast.Is()], [ast.NameConstant(None)])
send_warning = ast.parse(
"""\
from _pytest.warning_types import PytestAssertRewriteWarning