From ad3169428bc9fe3fb404c82b78c84f67a6011ec1 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Mon, 18 May 2020 14:20:13 -0300 Subject: [PATCH] Remove unused Function.__init__ 'args' parameter --- changelog/7226.breaking.rst | 1 + src/_pytest/python.py | 4 +--- testing/python/collect.py | 6 ++++-- 3 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 changelog/7226.breaking.rst diff --git a/changelog/7226.breaking.rst b/changelog/7226.breaking.rst new file mode 100644 index 000000000..bf1c443fc --- /dev/null +++ b/changelog/7226.breaking.rst @@ -0,0 +1 @@ +Removed the unused ``args`` parameter from ``pytest.Function.__init__``. diff --git a/src/_pytest/python.py b/src/_pytest/python.py index c943824fe..0224a2a89 100644 --- a/src/_pytest/python.py +++ b/src/_pytest/python.py @@ -1386,7 +1386,6 @@ class Function(PyobjMixin, nodes.Item): self, name, parent, - args=None, config=None, callspec: Optional[CallSpec2] = None, callobj=NOTSET, @@ -1399,7 +1398,6 @@ class Function(PyobjMixin, nodes.Item): param name: the full function name, including any decorations like those added by parametrization (``my_func[my_param]``). param parent: the parent Node. - param args: (unused) param config: the pytest Config object param callspec: if given, this is function has been parametrized and the callspec contains meta information about the parametrization. @@ -1415,7 +1413,7 @@ class Function(PyobjMixin, nodes.Item): (``my_func[my_param]``). """ super().__init__(name, parent, config=config, session=session) - self._args = args + if callobj is not NOTSET: self.obj = callobj diff --git a/testing/python/collect.py b/testing/python/collect.py index 94441878c..2807cacc9 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -294,9 +294,11 @@ class TestFunction: def func2(): pass - f1 = self.make_function(testdir, name="name", args=(1,), callobj=func1) + f1 = self.make_function(testdir, name="name", callobj=func1) assert f1 == f1 - f2 = self.make_function(testdir, name="name", callobj=func2) + f2 = self.make_function( + testdir, name="name", callobj=func2, originalname="foobar" + ) assert f1 != f2 def test_repr_produces_actual_test_id(self, testdir):