Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused Function.__init__ 'args' parameter #7226

Merged
merged 1 commit into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/7226.breaking.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Removed the unused ``args`` parameter from ``pytest.Function.__init__``.
4 changes: 1 addition & 3 deletions src/_pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -1386,7 +1386,6 @@ def __init__(
self,
name,
parent,
args=None,
config=None,
callspec: Optional[CallSpec2] = None,
callobj=NOTSET,
Expand All @@ -1399,7 +1398,6 @@ def __init__(
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.
Expand All @@ -1415,7 +1413,7 @@ def __init__(
(``my_func[my_param]``).
"""
super().__init__(name, parent, config=config, session=session)
self._args = args

if callobj is not NOTSET:
self.obj = callobj

Expand Down
6 changes: 4 additions & 2 deletions testing/python/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,11 @@ def func1():
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):
Expand Down