[Pytest-commit] Issue #740: internal error when parametrising using yield functools.partial (pytest-dev/pytest)
Dima Tisnek
issues-reply at bitbucket.org
Fri May 8 16:05:12 CEST 2015
New issue 740: internal error when parametrising using yield functools.partial
https://bitbucket.org/pytest-dev/pytest/issue/740/internal-error-when-parametrising-using
Dima Tisnek:
Traceback is far below.
Unfortunately I cannot yet create a minimum reproducible example, because everything works, if I remove propitiatory code.
Note that all tests pass (I can remove all asserts even), but there's still an internal error.
Below is the outline of the test:
```
#!python
import functools
backup = []
def setup():
backup[:] = secret, secret, secret
secret.init()
def teardown():
secret, secret, secret = backup[:]
def test_one(foo=123):
tmp = secret.secretObject()
tmp.init(...)
def test_all():
for somearg in range(10):
yield functools.partial(test_one, somearg)
```
```
#!python
(plc)[dima at bmg 18src]$ py.test -v test_foo.py
================================================================================== test session starts ==================================================================================
platform linux2 -- Python 2.7.9 -- py-1.4.27 -- pytest-2.7.0 -- /dima/plc/bin/python2
rootdir: /dima/tmp/sync_18/module/sync/python/src, inifile:
plugins: incremental, ipdb, cov, random, xdist
collected 6 items
test_foo.py::test_convert_and_filter_external_simple PASSED
[location]
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/main.py", line 84, in wrap_session
INTERNALERROR> doit(config, session)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/main.py", line 122, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
INTERNALERROR> return self._docall(self.methods, kwargs)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
INTERNALERROR> firstresult=self.firstresult).execute()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
INTERNALERROR> res = method(*args)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/main.py", line 142, in pytest_runtestloop
INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
INTERNALERROR> return self._docall(self.methods, kwargs)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
INTERNALERROR> firstresult=self.firstresult).execute()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 393, in execute
INTERNALERROR> return wrapped_call(method(*args), self.execute)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 113, in wrapped_call
INTERNALERROR> return call_outcome.get_result()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 138, in get_result
INTERNALERROR> py.builtin._reraise(*ex)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 123, in __init__
INTERNALERROR> self.result = func()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
INTERNALERROR> res = method(*args)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/runner.py", line 65, in pytest_runtest_protocol
INTERNALERROR> runtestprotocol(item, nextitem=nextitem)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/runner.py", line 75, in runtestprotocol
INTERNALERROR> reports.append(call_and_report(item, "call", log))
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/runner.py", line 121, in call_and_report
INTERNALERROR> report = hook.pytest_runtest_makereport(item=item, call=call)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 521, in __call__
INTERNALERROR> return self._docall(self.methods, kwargs)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 528, in _docall
INTERNALERROR> firstresult=self.firstresult).execute()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 393, in execute
INTERNALERROR> return wrapped_call(method(*args), self.execute)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 109, in wrapped_call
INTERNALERROR> wrap_controller.send(call_outcome)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/skipping.py", line 157, in pytest_runtest_makereport
INTERNALERROR> rep = outcome.get_result()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 138, in get_result
INTERNALERROR> py.builtin._reraise(*ex)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 123, in __init__
INTERNALERROR> self.result = func()
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/core.py", line 394, in execute
INTERNALERROR> res = method(*args)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/runner.py", line 224, in pytest_runtest_makereport
INTERNALERROR> longrepr = item.repr_failure(excinfo)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/python.py", line 625, in repr_failure
INTERNALERROR> return self._repr_failure_py(excinfo, style=style)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/python.py", line 618, in _repr_failure_py
INTERNALERROR> style=style)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/main.py", line 397, in _repr_failure_py
INTERNALERROR> self._prunetraceback(excinfo)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/_pytest/python.py", line 597, in _prunetraceback
INTERNALERROR> code = py.code.Code(self.obj)
INTERNALERROR> File "/dima/plc/lib/python2.7/site-packages/py/_code/code.py", line 24, in __init__
INTERNALERROR> raise TypeError("not a code object: %r" %(rawcode,))
INTERNALERROR> TypeError: not a code object: <functools.partial object at 0x7f7a3590d788>
=============================================================================== 1 passed in 0.20 seconds ================================================================================
```
More information about the pytest-commit
mailing list