re #320 fallback to test scope if the class-scoped fixture is used in non-class-based test function

--HG--
branch : 320-class-scoped-fixture-caching-is-broken-if
This commit is contained in:
Anatoly Bubenkov
2013-07-06 21:30:24 +02:00
parent c36186ce65
commit 589138ea71
3 changed files with 33 additions and 4 deletions

View File

@@ -513,12 +513,12 @@ class TestRequestCachedSetup:
def test_request_cachedsetup_class(self, testdir):
reprec = testdir.inline_runsource("""
mysetup = ["hello", "hello2"].pop
mysetup = ["hello", "hello2", "hello3"].pop
def pytest_funcarg__something(request):
return request.cached_setup(mysetup, scope="class")
def test_func1(something):
assert something == "hello2"
assert something == "hello3"
def test_func2(something):
assert something == "hello2"
class TestClass:
@@ -1090,7 +1090,7 @@ class TestAutouseManagement:
def arg():
l.append(1)
return 0
@pytest.fixture(scope="class", autouse=True)
@pytest.fixture(scope="module", autouse=True)
def something(arg):
l.append(2)