fix issue198 - detection of fixtures from conftest.py files in deeper nested dir structures with certain invocations
This commit is contained in:
parent
26ab80c4cd
commit
67de2c53ac
|
@ -1,6 +1,8 @@
|
||||||
Changes between 2.2.4 and 2.3.0.dev
|
Changes between 2.2.4 and 2.3.0.dev
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
|
|
||||||
|
- fix issue198 - conftest fixtures were not found on windows32 in some
|
||||||
|
circumstances with nested directory structures due to path manipulation issues
|
||||||
- fix issue193 skip test functions with were parametrized with empty
|
- fix issue193 skip test functions with were parametrized with empty
|
||||||
parameter sets
|
parameter sets
|
||||||
- fix python3.3 compat, mostly reporting bits that previously depended
|
- fix python3.3 compat, mostly reporting bits that previously depended
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
#
|
#
|
||||||
__version__ = '2.3.0.dev26'
|
__version__ = '2.3.0.dev27'
|
||||||
|
|
|
@ -731,6 +731,7 @@ def _showfixtures_main(config, session):
|
||||||
else:
|
else:
|
||||||
part = session._initialparts[0]
|
part = session._initialparts[0]
|
||||||
nodeid = "::".join(map(str, [curdir.bestrelpath(part[0])] + part[1:]))
|
nodeid = "::".join(map(str, [curdir.bestrelpath(part[0])] + part[1:]))
|
||||||
|
nodeid.replace(session.fspath.sep, "/")
|
||||||
|
|
||||||
tw = py.io.TerminalWriter()
|
tw = py.io.TerminalWriter()
|
||||||
verbose = config.getvalue("verbose")
|
verbose = config.getvalue("verbose")
|
||||||
|
@ -1417,6 +1418,8 @@ class FixtureManager:
|
||||||
else:
|
else:
|
||||||
if p.basename.startswith("conftest.py"):
|
if p.basename.startswith("conftest.py"):
|
||||||
nodeid = p.dirpath().relto(self.session.fspath)
|
nodeid = p.dirpath().relto(self.session.fspath)
|
||||||
|
if p.sep != "/":
|
||||||
|
nodeid.replace(p.sep, "/")
|
||||||
self.parsefactories(plugin, nodeid)
|
self.parsefactories(plugin, nodeid)
|
||||||
self._seenplugins.add(plugin)
|
self._seenplugins.add(plugin)
|
||||||
|
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -24,7 +24,7 @@ def main():
|
||||||
name='pytest',
|
name='pytest',
|
||||||
description='py.test: simple powerful testing with Python',
|
description='py.test: simple powerful testing with Python',
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
version='2.3.0.dev26',
|
version='2.3.0.dev27',
|
||||||
url='http://pytest.org',
|
url='http://pytest.org',
|
||||||
license='MIT license',
|
license='MIT license',
|
||||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||||
|
|
|
@ -2974,3 +2974,19 @@ def test_funcargnames_compatattr(testdir):
|
||||||
""")
|
""")
|
||||||
reprec = testdir.inline_run()
|
reprec = testdir.inline_run()
|
||||||
reprec.assertoutcome(passed=1)
|
reprec.assertoutcome(passed=1)
|
||||||
|
|
||||||
|
def test_fixtures_sub_subdir_normalize_sep(testdir):
|
||||||
|
# this makes sure that normlization of nodeids takes place
|
||||||
|
b = testdir.mkdir("tests").mkdir("unit")
|
||||||
|
b.join("conftest.py").write(py.code.Source("""
|
||||||
|
def pytest_funcarg__arg1():
|
||||||
|
pass
|
||||||
|
"""))
|
||||||
|
p = b.join("test_module.py")
|
||||||
|
p.write("def test_func(arg1): pass")
|
||||||
|
result = testdir.runpytest(p, "--fixtures")
|
||||||
|
assert result.ret == 0
|
||||||
|
result.stdout.fnmatch_lines("""
|
||||||
|
*fixtures defined*conftest*
|
||||||
|
*arg1*
|
||||||
|
""")
|
||||||
|
|
Loading…
Reference in New Issue