Remove dead-code related to yield tests
Just noticed some code that no longer is needed when we removed yield-tests
This commit is contained in:
parent
936f725b81
commit
47bd1688ed
|
@ -0,0 +1 @@
|
||||||
|
Some left-over internal code related to ``yield`` tests has been removed.
|
|
@ -209,17 +209,12 @@ def _test_pytest_function(pyfuncitem):
|
||||||
_pdb = pytestPDB._init_pdb()
|
_pdb = pytestPDB._init_pdb()
|
||||||
testfunction = pyfuncitem.obj
|
testfunction = pyfuncitem.obj
|
||||||
pyfuncitem.obj = _pdb.runcall
|
pyfuncitem.obj = _pdb.runcall
|
||||||
if pyfuncitem._isyieldedfunction():
|
if "func" in pyfuncitem._fixtureinfo.argnames:
|
||||||
arg_list = list(pyfuncitem._args)
|
raise ValueError("--trace can't be used with a fixture named func!")
|
||||||
arg_list.insert(0, testfunction)
|
pyfuncitem.funcargs["func"] = testfunction
|
||||||
pyfuncitem._args = tuple(arg_list)
|
new_list = list(pyfuncitem._fixtureinfo.argnames)
|
||||||
else:
|
new_list.append("func")
|
||||||
if "func" in pyfuncitem._fixtureinfo.argnames:
|
pyfuncitem._fixtureinfo.argnames = tuple(new_list)
|
||||||
raise ValueError("--trace can't be used with a fixture named func!")
|
|
||||||
pyfuncitem.funcargs["func"] = testfunction
|
|
||||||
new_list = list(pyfuncitem._fixtureinfo.argnames)
|
|
||||||
new_list.append("func")
|
|
||||||
pyfuncitem._fixtureinfo.argnames = tuple(new_list)
|
|
||||||
|
|
||||||
|
|
||||||
def _enter_pdb(node, excinfo, rep):
|
def _enter_pdb(node, excinfo, rep):
|
||||||
|
|
|
@ -156,14 +156,9 @@ def pytest_configure(config):
|
||||||
@hookimpl(trylast=True)
|
@hookimpl(trylast=True)
|
||||||
def pytest_pyfunc_call(pyfuncitem):
|
def pytest_pyfunc_call(pyfuncitem):
|
||||||
testfunction = pyfuncitem.obj
|
testfunction = pyfuncitem.obj
|
||||||
if pyfuncitem._isyieldedfunction():
|
funcargs = pyfuncitem.funcargs
|
||||||
testfunction(*pyfuncitem._args)
|
testargs = {arg: funcargs[arg] for arg in pyfuncitem._fixtureinfo.argnames}
|
||||||
else:
|
testfunction(**testargs)
|
||||||
funcargs = pyfuncitem.funcargs
|
|
||||||
testargs = {}
|
|
||||||
for arg in pyfuncitem._fixtureinfo.argnames:
|
|
||||||
testargs[arg] = funcargs[arg]
|
|
||||||
testfunction(**testargs)
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -1405,7 +1400,7 @@ class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr):
|
||||||
|
|
||||||
if fixtureinfo is None:
|
if fixtureinfo is None:
|
||||||
fixtureinfo = self.session._fixturemanager.getfixtureinfo(
|
fixtureinfo = self.session._fixturemanager.getfixtureinfo(
|
||||||
self, self.obj, self.cls, funcargs=not self._isyieldedfunction()
|
self, self.obj, self.cls, funcargs=True
|
||||||
)
|
)
|
||||||
self._fixtureinfo = fixtureinfo
|
self._fixtureinfo = fixtureinfo
|
||||||
self.fixturenames = fixtureinfo.names_closure
|
self.fixturenames = fixtureinfo.names_closure
|
||||||
|
@ -1419,16 +1414,11 @@ class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr):
|
||||||
|
|
||||||
def _initrequest(self):
|
def _initrequest(self):
|
||||||
self.funcargs = {}
|
self.funcargs = {}
|
||||||
if self._isyieldedfunction():
|
if hasattr(self, "callspec"):
|
||||||
assert not hasattr(
|
callspec = self.callspec
|
||||||
self, "callspec"
|
assert not callspec.funcargs
|
||||||
), "yielded functions (deprecated) cannot have funcargs"
|
if hasattr(callspec, "param"):
|
||||||
else:
|
self.param = callspec.param
|
||||||
if hasattr(self, "callspec"):
|
|
||||||
callspec = self.callspec
|
|
||||||
assert not callspec.funcargs
|
|
||||||
if hasattr(callspec, "param"):
|
|
||||||
self.param = callspec.param
|
|
||||||
self._request = fixtures.FixtureRequest(self)
|
self._request = fixtures.FixtureRequest(self)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -1448,9 +1438,6 @@ class Function(FunctionMixin, nodes.Item, fixtures.FuncargnamesCompatAttr):
|
||||||
"(compatonly) for code expecting pytest-2.2 style request objects"
|
"(compatonly) for code expecting pytest-2.2 style request objects"
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def _isyieldedfunction(self):
|
|
||||||
return getattr(self, "_args", None) is not None
|
|
||||||
|
|
||||||
def runtest(self):
|
def runtest(self):
|
||||||
""" execute the underlying test function. """
|
""" execute the underlying test function. """
|
||||||
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
|
self.ihook.pytest_pyfunc_call(pyfuncitem=self)
|
||||||
|
|
Loading…
Reference in New Issue