make sure setups are called ahead of the funcarg factories of the test function
This commit is contained in:
parent
754fab9b55
commit
7768972ec5
|
@ -895,9 +895,9 @@ class Function(FunctionMixin, pytest.Item):
|
|||
|
||||
def setup(self):
|
||||
super(Function, self).setup()
|
||||
fillfuncargs(self)
|
||||
if hasattr(self, "_request"):
|
||||
self._request._callsetup()
|
||||
fillfuncargs(self)
|
||||
|
||||
def __eq__(self, other):
|
||||
try:
|
||||
|
|
|
@ -2633,3 +2633,20 @@ def test_request_can_be_overridden(testdir):
|
|||
""")
|
||||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
||||
def test_setup_funcarg_order(testdir):
|
||||
testdir.makepyfile("""
|
||||
import pytest
|
||||
|
||||
l = []
|
||||
@pytest.setup()
|
||||
def fix1():
|
||||
l.append(1)
|
||||
@pytest.factory()
|
||||
def arg1():
|
||||
l.append(2)
|
||||
def test_hello(arg1):
|
||||
assert l == [1,2]
|
||||
""")
|
||||
reprec = testdir.inline_run()
|
||||
reprec.assertoutcome(passed=1)
|
||||
|
|
Loading…
Reference in New Issue