summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2021-02-23 17:56:42 +0100
committerFlorian Bruhin <me@the-compiler.org>2021-02-23 18:00:56 +0100
commit54a154c86f4806327081b80193cebca7934468d0 (patch)
tree2fbe41332debbca355f77cbc76ee42cc6f37af9d /src
parentd6522b517bceca2c8f7be1a34a3efd7d741a3132 (diff)
downloadpytest-54a154c86f4806327081b80193cebca7934468d0.tar.gz
Allow Class.from_parent to forward custom parameters to the constructor
Similarly to #7143, at work we have a project with a custom pytest.Class subclass, adding an additional argument to the constructor. All from_parent implementations in pytest accept and forward *kw, except Class (before this change) and DoctestItem - since I'm not familiar with doctest support, I've left the latter as-is.
Diffstat (limited to 'src')
-rw-r--r--src/_pytest/python.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/_pytest/python.py b/src/_pytest/python.py
index 726241cb5..944c395a8 100644
--- a/src/_pytest/python.py
+++ b/src/_pytest/python.py
@@ -763,9 +763,9 @@ class Class(PyCollector):
"""Collector for test methods."""
@classmethod
- def from_parent(cls, parent, *, name, obj=None):
+ def from_parent(cls, parent, *, name, obj=None, **kw):
"""The public constructor."""
- return super().from_parent(name=name, parent=parent)
+ return super().from_parent(name=name, parent=parent, **kw)
def collect(self) -> Iterable[Union[nodes.Item, nodes.Collector]]:
if not safe_getattr(self.obj, "__test__", True):