typographic fixes, little simplification
This commit is contained in:
parent
2855a2f6cb
commit
dc4e205876
|
@ -361,7 +361,6 @@ class FixtureMapper:
|
|||
|
||||
def __init__(self, node, funcargs=True):
|
||||
self.node = node
|
||||
self.fm = node.session._fixturemanager
|
||||
self._name2fixtureinfo = {}
|
||||
self.hasfuncargs = funcargs
|
||||
|
||||
|
@ -378,8 +377,9 @@ class FixtureMapper:
|
|||
initialnames = argnames
|
||||
if usefixtures is not None:
|
||||
initialnames = usefixtures.args + initialnames
|
||||
names_closure, arg2fixturedefs = self.fm.getfixtureclosure(
|
||||
initialnames, self.node)
|
||||
fm = self.node.session._fixturemanager
|
||||
names_closure, arg2fixturedefs = fm.getfixtureclosure(initialnames,
|
||||
self.node)
|
||||
fixtureinfo = FuncFixtureInfo(argnames, names_closure,
|
||||
arg2fixturedefs)
|
||||
self._name2fixtureinfo[func] = fixtureinfo
|
||||
|
|
|
@ -456,24 +456,6 @@ def test_setup_only_available_in_subdir(testdir):
|
|||
"*2 passed*"
|
||||
])
|
||||
|
||||
def test_generate_tests_only_done_in_subdir(testdir):
|
||||
sub1 = testdir.mkpydir("sub1")
|
||||
sub2 = testdir.mkpydir("sub2")
|
||||
sub1.join("conftest.py").write(py.code.Source("""
|
||||
def pytest_generate_tests(metafunc):
|
||||
assert metafunc.function.__name__ == "test_1"
|
||||
"""))
|
||||
sub2.join("conftest.py").write(py.code.Source("""
|
||||
def pytest_generate_tests(metafunc):
|
||||
assert metafunc.function.__name__ == "test_2"
|
||||
"""))
|
||||
sub1.join("test_in_sub1.py").write("def test_1(): pass")
|
||||
sub2.join("test_in_sub2.py").write("def test_2(): pass")
|
||||
result = testdir.runpytest("-v", "-s", sub1, sub2, sub1)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*3 passed*"
|
||||
])
|
||||
|
||||
def test_modulecol_roundtrip(testdir):
|
||||
modcol = testdir.getmodulecol("pass", withinit=True)
|
||||
trail = modcol.nodeid
|
||||
|
@ -1404,7 +1386,7 @@ class TestMetafuncFunctional:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=5)
|
||||
|
||||
def test_usemarkers_seen_in_generate_tests(self, testdir):
|
||||
def test_usefixtures_seen_in_generate_tests(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
def pytest_generate_tests(metafunc):
|
||||
|
@ -1418,6 +1400,25 @@ class TestMetafuncFunctional:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
def test_generate_tests_only_done_in_subdir(self, testdir):
|
||||
sub1 = testdir.mkpydir("sub1")
|
||||
sub2 = testdir.mkpydir("sub2")
|
||||
sub1.join("conftest.py").write(py.code.Source("""
|
||||
def pytest_generate_tests(metafunc):
|
||||
assert metafunc.function.__name__ == "test_1"
|
||||
"""))
|
||||
sub2.join("conftest.py").write(py.code.Source("""
|
||||
def pytest_generate_tests(metafunc):
|
||||
assert metafunc.function.__name__ == "test_2"
|
||||
"""))
|
||||
sub1.join("test_in_sub1.py").write("def test_1(): pass")
|
||||
sub2.join("test_in_sub2.py").write("def test_2(): pass")
|
||||
result = testdir.runpytest("-v", "-s", sub1, sub2, sub1)
|
||||
result.stdout.fnmatch_lines([
|
||||
"*3 passed*"
|
||||
])
|
||||
|
||||
|
||||
def test_conftest_funcargs_only_available_in_subdir(testdir):
|
||||
sub1 = testdir.mkpydir("sub1")
|
||||
sub2 = testdir.mkpydir("sub2")
|
||||
|
@ -1464,6 +1465,7 @@ def test_funcarg_non_pycollectobj(testdir): # rough jstests usage
|
|||
assert clscol.funcargs['arg1'] == 42
|
||||
|
||||
|
||||
|
||||
def test_funcarg_lookup_error(testdir):
|
||||
p = testdir.makepyfile("""
|
||||
def test_lookup_error(unknown):
|
||||
|
@ -2000,7 +2002,7 @@ class TestFixtureManager:
|
|||
reprec = testdir.inline_run("-s")
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
class TestSetupDiscovery:
|
||||
class TestAutouseDiscovery:
|
||||
def pytest_funcarg__testdir(self, testdir):
|
||||
testdir.makeconftest("""
|
||||
import pytest
|
||||
|
@ -2153,7 +2155,7 @@ class TestSetupDiscovery:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=3)
|
||||
|
||||
class TestSetupManagement:
|
||||
class TestAutouseManagement:
|
||||
def test_funcarg_and_setup(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
@ -2179,7 +2181,7 @@ class TestSetupManagement:
|
|||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=2)
|
||||
|
||||
def test_setup_uses_parametrized_resource(self, testdir):
|
||||
def test_uses_parametrized_resource(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
l = []
|
||||
|
@ -2203,7 +2205,7 @@ class TestSetupManagement:
|
|||
reprec = testdir.inline_run("-s")
|
||||
reprec.assertoutcome(passed=2)
|
||||
|
||||
def test_session_parametrized_function_setup(self, testdir):
|
||||
def test_session_parametrized_function(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
|
@ -2265,7 +2267,7 @@ class TestSetupManagement:
|
|||
l = config._conftest.getconftestmodules(p)[0].l
|
||||
assert l == ["fin_a1", "fin_a2", "fin_b1", "fin_b2"] * 2
|
||||
|
||||
def test_setup_scope_ordering(self, testdir):
|
||||
def test_scope_ordering(self, testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
l = []
|
||||
|
|
Loading…
Reference in New Issue