-
Notifications
You must be signed in to change notification settings - Fork 222
Closed
Description
Since
commit: 002b90d ("util/helper: make ProcessWrapper callbacks non-nested static methods")
the usage of pytester plugin is broken.
Testcase: pytest test_tmpdir.py
test_tmpdir.py:
import pytest
pytest_plugins = ["pytester"]
def test_testdir(testdir):
testdir.parseconfigure("-h")
Will result in
____________________________________________________________ test_testdir ____________________________________________________________
testdir = <Testdir local('/tmp/pytest-of-jremmet/pytest-2/test_testdir0')>
def test_testdir(testdir):
> testdir.parseconfigure("-h")
/home/jremmet/tmp/labgrid/test_tmpdir.py:6:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
buf += b'\n'
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/_pytest/pytester.py:1130: in parseconfigure
config._do_configure()
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/_pytest/config/__init__.py:982: in _do_configure
self.hook.pytest_configure.call_historic(kwargs=dict(config=self))
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/pluggy/hooks.py:308: in call_historic
res = self._hookexec(self, self.get_hookimpls(), kwargs)
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/pluggy/manager.py:87: in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/labgrid/pytestplugin/hooks.py:50: in pytest_configure
processwrapper.enable_logging()
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/labgrid/util/helper.py:128: in enable_logging
self.register(ProcessWrapper.log_callback)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = ProcessWrapper(callbacks=[<function ProcessWrapper.log_callback at 0x7efeb3370560>])
callback = <function ProcessWrapper.log_callback at 0x7efeb3370560>
def register(self, callback):
"""Register a callback with the ProcessWrapper"""
> assert callback not in self.callbacks
E assert <function ProcessWrapper.log_callback at 0x7efeb3370560> not in [<function ProcessWrapper.log_callback at 0x7efeb3370560>]
E + where [<function ProcessWrapper.log_callback at 0x7efeb3370560>] = ProcessWrapper(callbacks=[<function ProcessWrapper.log_callback at 0x7efeb3370560>]).callbacks
/home/jremmet/tmp/labgrid/venv-only/lib/python3.7/site-packages/labgrid/util/helper.py:104: AssertionError
====================================================== short test summary info =======================================================
FAILED test_tmpdir.py::test_testdir - assert <function ProcessWrapper.log_callback at 0x7efeb3370560> not in [<function ProcessWrap...
========================================================= 1 failed in 0.12s ==========================================================
Metadata
Metadata
Assignees
Labels
No labels