diff --git a/py/code/testing/test_source.py b/py/code/testing/test_source.py index eb67fcda7..0c2045478 100644 --- a/py/code/testing/test_source.py +++ b/py/code/testing/test_source.py @@ -326,16 +326,11 @@ def test_getsource_fallback(): src = getsource(x) assert src == expected -def test_getsource___source__(): +def test_idem_compile_and_getsource(): from py.__.code.source import getsource - x = py.code.compile("""if 1: - def x(): - pass -""") - - expected = """def x(): - pass""" - src = getsource(x) + expected = "def x(): pass" + co = py.code.compile(expected) + src = getsource(co) assert src == expected def test_findsource_fallback(): @@ -346,11 +341,17 @@ def test_findsource_fallback(): def test_findsource___source__(): from py.__.code.source import findsource - x = py.code.compile("""if 1: + co = py.code.compile("""if 1: def x(): pass """) - src, lineno = findsource(x) + src, lineno = findsource(co) assert 'if 1:' in str(src) - assert src[lineno] == ' def x():' + + d = {} + eval(co, d) + src, lineno = findsource(d['x']) + assert 'if 1:' in str(src) + assert src[lineno] == " def x():" + diff --git a/py/execnet/testing/test_gwspec.py b/py/execnet/testing/test_gwspec.py index 5ebabbcaf..3bcf5ff54 100644 --- a/py/execnet/testing/test_gwspec.py +++ b/py/execnet/testing/test_gwspec.py @@ -18,7 +18,7 @@ class TestGatewaySpec: print s spec = py.execnet.GatewaySpec(s) assert spec.address == "popen" - assert spec.python == python + assert spec.python == (python or py.std.sys.executable) assert spec.joinpath == joinpath assert spec.type == "popen" spec2 = py.execnet.GatewaySpec("popen" + joinpath) diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index 448dafe9a..8dfc73760 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -325,7 +325,7 @@ class TestTerminal: rep = TerminalReporter(item.config, linecomp.stringio) rep.pyevent_hostup(makehostup()) linecomp.assert_contains_lines([ - "*inline %s %s - Python %s" %(sys.platform, + "*INPROCESS* %s %s - Python %s" %(sys.platform, sys.executable, repr_pythonversion(sys.version_info)) ])