Merge pull request #7749 from bluetech/fix-get_source-crash

This commit is contained in:
Bruno Oliveira
2020-09-19 10:38:32 -03:00
parent 819fef87a7
commit 6933bf6b4d
3 changed files with 26 additions and 4 deletions

View File

@@ -1427,3 +1427,17 @@ class TestImportModeImportlib:
"* 1 failed in *",
]
)
def test_does_not_crash_on_error_from_decorated_function(testdir: Testdir) -> None:
"""Regression test for an issue around bad exception formatting due to
assertion rewriting mangling lineno's (#4984)."""
testdir.makepyfile(
"""
@pytest.fixture
def a(): return 4
"""
)
result = testdir.runpytest()
# Not INTERNAL_ERROR
assert result.ret == ExitCode.INTERRUPTED