code/source: inline getsource()

The recursive way in which Source and getsource interact is a bit
confusing, just inline it.
This commit is contained in:
Ran Benita
2020-07-01 20:20:13 +03:00
parent ef39115001
commit f5c69f3eb2
2 changed files with 5 additions and 11 deletions

View File

@@ -307,12 +307,10 @@ if True:
pass
def test_getsource_fallback() -> None:
from _pytest._code.source import getsource
def test_source_fallback() -> None:
src = Source(x)
expected = """def x():
pass"""
src = getsource(x)
assert str(src) == expected