make sure ihook uses a node's fspath - important for hooks

e.g. during a Module's collect to pick up conftest.py files
residing in the same dir
This commit is contained in:
holger krekel
2012-10-22 16:12:22 +02:00
parent f28f073c7c
commit 05c86aeb28
6 changed files with 40 additions and 13 deletions

View File

@@ -419,6 +419,28 @@ class TestConftestCustomization:
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_customized_pymakeitem(self, testdir):
b = testdir.mkdir("a").mkdir("b")
b.join("conftest.py").write(py.code.Source("""
def pytest_pycollect_makeitem(__multicall__):
result = __multicall__.execute()
if result:
for func in result:
func._some123 = "world"
return result
"""))
b.join("test_module.py").write(py.code.Source("""
import pytest
@pytest.fixture()
def obj(request):
return request.node._some123
def test_hello(obj):
assert obj == "world"
"""))
reprec = testdir.inline_run()
reprec.assertoutcome(passed=1)
def test_pytest_pycollect_makeitem(self, testdir):
testdir.makeconftest("""
import pytest