pytest: Unexpected keyword argument 'path' from plugins
While troubleshooting #8332, I stumbled onto a new error, a TypeError
that occurs when using pytest-black against the current main HEAD (32ad70d), easily reproducible with an empty test file and pip-run:
draft $ touch test_something.py
draft $ pip-run -q git+https://github.com/pytest-dev/pytest pytest-black -- -m pytest --black
===================================================================================== test session starts =====================================================================================
platform darwin -- Python 3.9.2, pytest-6.3.0.dev252+g32ad70dea, py-1.10.0, pluggy-0.13.1
rootdir: /Users/jaraco/draft
plugins: black-0.3.12
collected 0 items / 1 error
=========================================================================================== ERRORS ============================================================================================
________________________________________________________________________________ ERROR collecting test session ________________________________________________________________________________
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/pluggy/manager.py:84: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/pytest_black.py:27: in pytest_collect_file
return BlackItem.from_parent(parent, fspath=path)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/_pytest/nodes.py:578: in from_parent
return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/_pytest/nodes.py:226: in from_parent
return cls._create(parent=parent, **kw)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-j9xn8e36/_pytest/nodes.py:117: in _create
return super().__call__(*k, **kw)
E TypeError: __init__() got an unexpected keyword argument 'path'
=================================================================================== short test summary info ===================================================================================
ERROR - TypeError: __init__() got an unexpected keyword argument 'path'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 1 error in 0.13s =======================================================================================
Same problem happens with pytest-checkdocs:
draft $ touch setup.py
draft $ pip-run -q git+https://github.com/pytest-dev/pytest pytest-checkdocs -- -m pytest
===================================================================================== test session starts =====================================================================================
platform darwin -- Python 3.9.2, pytest-6.3.0.dev252+g32ad70dea, py-1.10.0, pluggy-0.13.1
rootdir: /Users/jaraco/draft
plugins: checkdocs-2.4.0
collected 0 items / 1 error
=========================================================================================== ERRORS ============================================================================================
________________________________________________________________________________ ERROR collecting test session ________________________________________________________________________________
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/pluggy/hooks.py:286: in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/pluggy/manager.py:93: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/pluggy/manager.py:84: in <lambda>
self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/pytest_checkdocs/__init__.py:14: in pytest_collect_file
CheckdocsItem.from_parent(parent, fspath=path)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/pytest_checkdocs/__init__.py:52: in from_parent
return super().from_parent(parent, fspath=fspath)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/_pytest/nodes.py:578: in from_parent
return super().from_parent(parent=parent, fspath=fspath, path=path, **kw)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/_pytest/nodes.py:226: in from_parent
return cls._create(parent=parent, **kw)
/var/folders/c6/v7hnmq453xb6p2dbz1gqc6rr0000gn/T/pip-run-5hc5__bb/_pytest/nodes.py:117: in _create
return super().__call__(*k, **kw)
E TypeError: __init__() got an unexpected keyword argument 'path'
=================================================================================== short test summary info ===================================================================================
ERROR - TypeError: __init__() got an unexpected keyword argument 'path'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 error during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================================== 1 error in 0.20s =======================================================================================
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 16 (16 by maintainers)
Commits related to this issue
- issue a waring when Items and collectors for a diamond addresses #8435 — committed to RonnyPfannschmidt/pytest by RonnyPfannschmidt 3 years ago
- issue a warning when Items and Collector form a diamond addresses #8435 — committed to RonnyPfannschmidt/pytest by RonnyPfannschmidt 3 years ago
- issue a warning when Items and Collector form a diamond addresses #8435 — committed to RonnyPfannschmidt/pytest by RonnyPfannschmidt 3 years ago
- issue a warning when Items and Collector form a diamond addresses #8435 — committed to RonnyPfannschmidt/pytest by RonnyPfannschmidt 3 years ago
- issue a warning when Items and Collector form a diamond addresses #8435 — committed to RonnyPfannschmidt/pytest by RonnyPfannschmidt 3 years ago
- issue a warning when Items and Collector form a diamond addresses #8435 — committed to RonnyPfannschmidt/pytest by RonnyPfannschmidt 3 years ago
- issue a warning when Item and Collector are used in diamond inheritance (#8447) * issue a warning when Items and Collector form a diamond addresses #8435 * Apply suggestions from code review ... — committed to pytest-dev/pytest by RonnyPfannschmidt 3 years ago
- nodes: keep plugins which subclass Item, File working for a bit more Fix #8435. — committed to bluetech/pytest by bluetech 3 years ago
- nodes: keep plugins which subclass Item, File working for a bit more (#9279) * nodes: keep plugins which subclass Item, File working for a bit more Fix #8435. * Update src/_pytest/nodes.py C... — committed to pytest-dev/pytest by bluetech 3 years ago
Sounds like I definitely should sort out the signature of the create call and issue a warning
Hey @jaraco,
I’m making a quick guess as I don’t have time to delve deep into the code, but perhaps
from_parent
inpytest_checkdocs/__init__.py:52
needs to receive**kw
and pass that on tosuper()
?cc @RonnyPfannschmidt