re-introduce py.test.mark and move py.test.xfail to py.test.mark.xfail
--HG-- branch : 1.0.x
This commit is contained in:
		
							parent
							
								
									bd8f68555d
								
							
						
					
					
						commit
						8b7dfb29c5
					
				|  | @ -1,7 +1,11 @@ | ||||||
| Changes between 1.0.0b3 and 1.0.0 | Changes between 1.0.0b3 and 1.0.0b6 | ||||||
| ============================================= | ============================================= | ||||||
| 
 | 
 | ||||||
|  | * renamed py.test.xfail back to py.test.mark.xfail to avoid  | ||||||
|  |   two ways to decorate for xfail | ||||||
|  | 
 | ||||||
| * re-added py.test.mark decorator for setting keywords on functions  | * re-added py.test.mark decorator for setting keywords on functions  | ||||||
|  |   (it was actually documented so removing it was not nice)  | ||||||
| 
 | 
 | ||||||
| * remove scope-argument from request.addfinalizer() because  | * remove scope-argument from request.addfinalizer() because  | ||||||
|   request.cached_setup has the scope arg. TOOWTDI.  |   request.cached_setup has the scope arg. TOOWTDI.  | ||||||
|  |  | ||||||
|  | @ -543,7 +543,7 @@ class TestPopenGateway(PopenGatewayTestSetup, BasicRemoteExecution): | ||||||
|             ret = channel.receive() |             ret = channel.receive() | ||||||
|             assert ret == 42 |             assert ret == 42 | ||||||
|              |              | ||||||
|     @py.test.xfail # "fix needed: dying remote process does not cause waitclose() to fail" |     @py.test.mark.xfail # "fix needed: dying remote process does not cause waitclose() to fail" | ||||||
|     def test_waitclose_on_remote_killed(self): |     def test_waitclose_on_remote_killed(self): | ||||||
|         gw = py.execnet.PopenGateway() |         gw = py.execnet.PopenGateway() | ||||||
|         channel = gw.remote_exec(""" |         channel = gw.remote_exec(""" | ||||||
|  | @ -616,12 +616,12 @@ class TestSshGateway(BasicRemoteExecution): | ||||||
|     def test_sshaddress(self): |     def test_sshaddress(self): | ||||||
|         assert self.gw.remoteaddress == self.sshhost |         assert self.gw.remoteaddress == self.sshhost | ||||||
| 
 | 
 | ||||||
|     @py.test.xfail # XXX ssh-gateway error handling |     @py.test.mark.xfail # XXX ssh-gateway error handling | ||||||
|     def test_connexion_failes_on_non_existing_hosts(self): |     def test_connexion_failes_on_non_existing_hosts(self): | ||||||
|         py.test.raises(IOError,  |         py.test.raises(IOError,  | ||||||
|             "py.execnet.SshGateway('nowhere.codespeak.net')") |             "py.execnet.SshGateway('nowhere.codespeak.net')") | ||||||
| 
 | 
 | ||||||
|     @py.test.xfail # "XXX ssh-gateway error handling" |     @py.test.mark.xfail # "XXX ssh-gateway error handling" | ||||||
|     def test_deprecated_identity(self): |     def test_deprecated_identity(self): | ||||||
|         py.test.deprecated_call( |         py.test.deprecated_call( | ||||||
|             py.test.raises, IOError,  |             py.test.raises, IOError,  | ||||||
|  |  | ||||||
|  | @ -367,7 +367,7 @@ class TestDSession: | ||||||
|         assert node.gateway.spec.popen |         assert node.gateway.spec.popen | ||||||
|         #XXX eq.geteventargs("pytest_sessionfinish") |         #XXX eq.geteventargs("pytest_sessionfinish") | ||||||
| 
 | 
 | ||||||
|     @py.test.xfail |     @py.test.mark.xfail | ||||||
|     def test_collected_function_causes_remote_skip_at_module_level(self, testdir): |     def test_collected_function_causes_remote_skip_at_module_level(self, testdir): | ||||||
|         p = testdir.makepyfile(""" |         p = testdir.makepyfile(""" | ||||||
|             import py |             import py | ||||||
|  |  | ||||||
|  | @ -11,7 +11,7 @@ class pytest_funcarg__mysetup: | ||||||
|         request.getfuncargvalue("_pytest") |         request.getfuncargvalue("_pytest") | ||||||
| 
 | 
 | ||||||
| class TestNodeManager: | class TestNodeManager: | ||||||
|     @py.test.xfail |     @py.test.mark.xfail | ||||||
|     def test_rsync_roots_no_roots(self, mysetup): |     def test_rsync_roots_no_roots(self, mysetup): | ||||||
|         mysetup.source.ensure("dir1", "file1").write("hello") |         mysetup.source.ensure("dir1", "file1").write("hello") | ||||||
|         config = py.test.config._reparse([source]) |         config = py.test.config._reparse([source]) | ||||||
|  |  | ||||||
|  | @ -3,13 +3,15 @@ mark tests as expected-to-fail and report them separately. | ||||||
| 
 | 
 | ||||||
| example:  | example:  | ||||||
| 
 | 
 | ||||||
|     @py.test.xfail |     @py.test.mark.xfail | ||||||
|     def test_hello(): |     def test_hello(): | ||||||
|         ... |         ... | ||||||
|         assert 0 |         assert 0 | ||||||
| """ | """ | ||||||
| import py | import py | ||||||
| 
 | 
 | ||||||
|  | pytest_plugins = ['keyword'] | ||||||
|  | 
 | ||||||
| def pytest_runtest_makereport(__call__, item, call): | def pytest_runtest_makereport(__call__, item, call): | ||||||
|     if call.when != "call": |     if call.when != "call": | ||||||
|         return |         return | ||||||
|  | @ -52,12 +54,6 @@ def pytest_terminal_summary(terminalreporter): | ||||||
|         for event in xpassed: |         for event in xpassed: | ||||||
|             tr._tw.line("%s: xpassed" %(event.item,)) |             tr._tw.line("%s: xpassed" %(event.item,)) | ||||||
| 
 | 
 | ||||||
| def xfail_decorator(func): |  | ||||||
|     func.xfail = True |  | ||||||
|     return func |  | ||||||
|   |  | ||||||
| def pytest_namespace(config): |  | ||||||
|     return dict(xfail=xfail_decorator) |  | ||||||
| 
 | 
 | ||||||
| # =============================================================================== | # =============================================================================== | ||||||
| # | # | ||||||
|  | @ -68,11 +64,11 @@ def pytest_namespace(config): | ||||||
| def test_xfail(testdir, linecomp): | def test_xfail(testdir, linecomp): | ||||||
|     p = testdir.makepyfile(test_one=""" |     p = testdir.makepyfile(test_one=""" | ||||||
|         import py |         import py | ||||||
|         @py.test.xfail |         @py.test.mark.xfail | ||||||
|         def test_this(): |         def test_this(): | ||||||
|             assert 0 |             assert 0 | ||||||
| 
 | 
 | ||||||
|         @py.test.xfail |         @py.test.mark.xfail | ||||||
|         def test_that(): |         def test_that(): | ||||||
|             assert 1 |             assert 1 | ||||||
|     """) |     """) | ||||||
|  |  | ||||||
|  | @ -221,7 +221,7 @@ class TestPytestPluginInteractions: | ||||||
|         assert not pluginmanager.listattr("hello") |         assert not pluginmanager.listattr("hello") | ||||||
|         assert pluginmanager.listattr("x") == [42] |         assert pluginmanager.listattr("x") == [42] | ||||||
| 
 | 
 | ||||||
|     @py.test.xfail # setup call methods |     @py.test.mark.xfail # setup call methods | ||||||
|     def test_call_setup_participants(self, testdir): |     def test_call_setup_participants(self, testdir): | ||||||
|         testdir.makepyfile( |         testdir.makepyfile( | ||||||
|             conftest=""" |             conftest=""" | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue