fix issue205 - nested conftest to pickup pycollect_makemodule - relates to the two

reports of a failing doc/en/example/py2py3.
This commit is contained in:
holger krekel 2012-10-22 10:17:50 +02:00
parent 7e5efa0005
commit 97f03edcd6
5 changed files with 22 additions and 4 deletions

View File

@ -1,6 +1,9 @@
Changes between 2.3.1 and 2.3.2.dev Changes between 2.3.1 and 2.3.2.dev
----------------------------------- -----------------------------------
- fix issue205 - conftests in subdirs customizing
pytest_pycollect_makemodule now work properly
- add tox.ini to pytest distribution so that ignore-dirs and others config - add tox.ini to pytest distribution so that ignore-dirs and others config
bits are properly distributed for maintainers who run pytest-own tests bits are properly distributed for maintainers who run pytest-own tests

View File

@ -1,2 +1,2 @@
# #
__version__ = '2.3.2.dev3' __version__ = '2.3.2.dev4'

View File

@ -161,8 +161,8 @@ def pytest_collect_file(path, parent):
break break
else: else:
return return
return parent.ihook.pytest_pycollect_makemodule( ihook = parent.session.gethookproxy(path)
path=path, parent=parent) return ihook.pytest_pycollect_makemodule(path=path, parent=parent)
def pytest_pycollect_makemodule(path, parent): def pytest_pycollect_makemodule(path, parent):
return Module(path, parent) return Module(path, parent)

View File

@ -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.2.dev3', version='2.3.2.dev4',
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'],

View File

@ -404,6 +404,21 @@ class TestConftestCustomization:
"*<MyModule*xyz*", "*<MyModule*xyz*",
]) ])
def test_customized_pymakemodule_issue205_subdir(self, testdir):
b = testdir.mkdir("a").mkdir("b")
b.join("conftest.py").write(py.code.Source("""
def pytest_pycollect_makemodule(__multicall__):
mod = __multicall__.execute()
mod.obj.hello = "world"
return mod
"""))
b.join("test_module.py").write(py.code.Source("""
def test_hello():
assert hello == "world"
"""))
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_pytest_pycollect_makeitem(self, testdir): def test_pytest_pycollect_makeitem(self, testdir):
testdir.makeconftest(""" testdir.makeconftest("""
import pytest import pytest