committed a xfailing test for sibling conftests
--HG-- branch : trunk
This commit is contained in:
		
							parent
							
								
									31c91796c6
								
							
						
					
					
						commit
						d8fcc96563
					
				|  | @ -266,6 +266,35 @@ class TestRootCol: | ||||||
|         col2 = config._rootcol.fromtrail(trail) |         col2 = config._rootcol.fromtrail(trail) | ||||||
|         assert col2 == col |         assert col2 == col | ||||||
| 
 | 
 | ||||||
|  |     @py.test.mark.xfail(reason="http://bitbucket.org/hpk42/py-trunk/issue/109") | ||||||
|  |     def test_sibling_conftest_issue109(self, testdir): | ||||||
|  |         """ | ||||||
|  |         This test is to make sure that the conftest.py of sibling directories is not loaded | ||||||
|  |         if py.test is run for/in one of the siblings directory and those sibling directories | ||||||
|  |         are not packaged together with an __init__.py. See bitbucket issue #109. | ||||||
|  |         """ | ||||||
|  |         for dirname in ['a', 'b']: | ||||||
|  |             testdir.tmpdir.ensure(dirname, dir=True) | ||||||
|  |             testdir.tmpdir.ensure(dirname, '__init__.py') | ||||||
|  | 
 | ||||||
|  |             # To create the conftest.py I would like to use testdir.make*-methods | ||||||
|  |             # but as far as I have seen they can only create files in testdir.tempdir | ||||||
|  |             # Maybe there is a way to explicitly specifiy the directory on which those | ||||||
|  |             # methods work or a completely better way to do that? | ||||||
|  |             backupTmpDir = testdir.tmpdir | ||||||
|  |             testdir.tmpdir = testdir.tmpdir.join(dirname) | ||||||
|  |             testdir.makeconftest(""" | ||||||
|  |                 _DIR_NAME = '%s' | ||||||
|  |                 def pytest_configure(config): | ||||||
|  |                     if config.args and config.args[0] != _DIR_NAME: | ||||||
|  |                         raise Exception("py.test run for '" + config.args[0] + "', but '" + _DIR_NAME + "/conftest.py' loaded.") | ||||||
|  |             """ % dirname) | ||||||
|  |             testdir.tmpdir = backupTmpDir | ||||||
|  | 
 | ||||||
|  |         for dirname, other_dirname in [('a', 'b'), ('b', 'a')]: | ||||||
|  |             result = testdir.runpytest(dirname) | ||||||
|  |             assert result.ret == 0, "test_sibling_conftest: py.test run for '%s', but '%s/conftest.py' loaded." % (dirname, other_dirname) | ||||||
|  | 
 | ||||||
|     def test_totrail_topdir_and_beyond(self, testdir, tmpdir): |     def test_totrail_topdir_and_beyond(self, testdir, tmpdir): | ||||||
|         config = testdir.reparseconfig() |         config = testdir.reparseconfig() | ||||||
|         col = config.getnode(config.topdir) |         col = config.getnode(config.topdir) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue