[svn r63034] fixing some tests to work across python revisions

--HG--
branch : trunk
This commit is contained in:
hpk 2009-03-18 15:35:51 +01:00
parent 772658d616
commit ee52739b17
3 changed files with 15 additions and 14 deletions

View File

@ -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():"

View File

@ -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)

View File

@ -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))
])