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:
parent
7e5efa0005
commit
97f03edcd6
|
@ -1,6 +1,9 @@
|
|||
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
|
||||
bits are properly distributed for maintainers who run pytest-own tests
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#
|
||||
__version__ = '2.3.2.dev3'
|
||||
__version__ = '2.3.2.dev4'
|
||||
|
|
|
@ -161,8 +161,8 @@ def pytest_collect_file(path, parent):
|
|||
break
|
||||
else:
|
||||
return
|
||||
return parent.ihook.pytest_pycollect_makemodule(
|
||||
path=path, parent=parent)
|
||||
ihook = parent.session.gethookproxy(path)
|
||||
return ihook.pytest_pycollect_makemodule(path=path, parent=parent)
|
||||
|
||||
def pytest_pycollect_makemodule(path, parent):
|
||||
return Module(path, parent)
|
||||
|
|
2
setup.py
2
setup.py
|
@ -24,7 +24,7 @@ def main():
|
|||
name='pytest',
|
||||
description='py.test: simple powerful testing with Python',
|
||||
long_description = long_description,
|
||||
version='2.3.2.dev3',
|
||||
version='2.3.2.dev4',
|
||||
url='http://pytest.org',
|
||||
license='MIT license',
|
||||
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
|
||||
|
|
|
@ -404,6 +404,21 @@ class TestConftestCustomization:
|
|||
"*<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):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
|
Loading…
Reference in New Issue