move conftest visibility tests and their setup into a class, accomodates @nicoddemus 's comment

--HG--
branch : issue616
This commit is contained in:
holger krekel 2015-02-27 09:51:53 +01:00
parent d73e689991
commit 28c2327f73
1 changed files with 74 additions and 75 deletions

View File

@ -259,9 +259,8 @@ def test_conftest_found_with_double_dash(testdir):
""")
# conftest visibility, related to issue616
def _setup_tree(testdir):
class TestConftestVisibility:
def _setup_tree(self, testdir): # for issue616
# example mostly taken from:
# https://mail.python.org/pipermail/pytest-dev/2014-September/002617.html
runner = testdir.mkdir("empty")
@ -310,9 +309,9 @@ def _setup_tree(testdir):
"swc": swc,
"snc": snc}
# N.B.: "swc" stands for "subdir with conftest.py"
# "snc" stands for "subdir no [i.e. without] conftest.py"
@pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [
# N.B.: "swc" stands for "subdir with conftest.py"
# "snc" stands for "subdir no [i.e. without] conftest.py"
@pytest.mark.parametrize("chdir,testarg,expect_ntests_passed", [
("runner", "..", 3),
("package", "..", 3),
("swc", "../..", 3),
@ -332,11 +331,11 @@ def _setup_tree(testdir):
("package", "./snc", 1),
("swc", "../snc", 1),
("snc", ".", 1),
])
@pytest.mark.issue616
def test_parsefactories_relative_node_ids(
testdir, chdir,testarg, expect_ntests_passed):
dirs = _setup_tree(testdir)
])
@pytest.mark.issue616
def test_parsefactories_relative_node_ids(
self, testdir, chdir,testarg, expect_ntests_passed):
dirs = self._setup_tree(testdir)
print("pytest run in cwd: %s" %(
dirs[chdir].relto(testdir.tmpdir)))
print("pytestarg : %s" %(testarg))