[svn r63034] fixing some tests to work across python revisions
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									772658d616
								
							
						
					
					
						commit
						ee52739b17
					
				|  | @ -326,16 +326,11 @@ def test_getsource_fallback(): | ||||||
|     src = getsource(x) |     src = getsource(x) | ||||||
|     assert src == expected |     assert src == expected | ||||||
| 
 | 
 | ||||||
| def test_getsource___source__(): | def test_idem_compile_and_getsource(): | ||||||
|     from py.__.code.source import getsource |     from py.__.code.source import getsource | ||||||
|     x = py.code.compile("""if 1: |     expected = "def x(): pass" | ||||||
|     def x(): |     co = py.code.compile(expected) | ||||||
|         pass |     src = getsource(co) | ||||||
| """) |  | ||||||
| 
 |  | ||||||
|     expected = """def x(): |  | ||||||
|     pass""" |  | ||||||
|     src = getsource(x) |  | ||||||
|     assert src == expected |     assert src == expected | ||||||
| 
 | 
 | ||||||
| def test_findsource_fallback(): | def test_findsource_fallback(): | ||||||
|  | @ -346,11 +341,17 @@ def test_findsource_fallback(): | ||||||
| 
 | 
 | ||||||
| def test_findsource___source__(): | def test_findsource___source__(): | ||||||
|     from py.__.code.source import findsource |     from py.__.code.source import findsource | ||||||
|     x = py.code.compile("""if 1: |     co = py.code.compile("""if 1: | ||||||
|     def x(): |     def x(): | ||||||
|         pass |         pass | ||||||
| """) | """) | ||||||
|          |          | ||||||
|     src, lineno = findsource(x) |     src, lineno = findsource(co) | ||||||
|     assert 'if 1:' in str(src) |     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():" | ||||||
|  |      | ||||||
|  |  | ||||||
|  | @ -18,7 +18,7 @@ class TestGatewaySpec: | ||||||
|                 print s |                 print s | ||||||
|                 spec = py.execnet.GatewaySpec(s) |                 spec = py.execnet.GatewaySpec(s) | ||||||
|                 assert spec.address == "popen" |                 assert spec.address == "popen" | ||||||
|                 assert spec.python == python  |                 assert spec.python == (python or py.std.sys.executable) | ||||||
|                 assert spec.joinpath == joinpath |                 assert spec.joinpath == joinpath | ||||||
|                 assert spec.type == "popen" |                 assert spec.type == "popen" | ||||||
|                 spec2 = py.execnet.GatewaySpec("popen" + joinpath) |                 spec2 = py.execnet.GatewaySpec("popen" + joinpath) | ||||||
|  |  | ||||||
|  | @ -325,7 +325,7 @@ class TestTerminal: | ||||||
|         rep = TerminalReporter(item.config, linecomp.stringio) |         rep = TerminalReporter(item.config, linecomp.stringio) | ||||||
|         rep.pyevent_hostup(makehostup()) |         rep.pyevent_hostup(makehostup()) | ||||||
|         linecomp.assert_contains_lines([ |         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)) |             sys.executable, repr_pythonversion(sys.version_info)) | ||||||
|         ]) |         ]) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue