Skip to content

Commit

Permalink
Apply bluetech suggestions on PR
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed May 15, 2020
1 parent c145437 commit 773db73
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/_pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ def _genfunctions(self, name, funcobj):
self.ihook.pytest_generate_tests.call_extra(methods, dict(metafunc=metafunc))

if not metafunc._calls:
yield Function.from_parent(self, name=name, fixtureinfo=fixtureinfo)
yield Function.from_parent(
self, name=name, fixtureinfo=fixtureinfo, originalname=name
)
else:
# add funcargs() as fixturedefs to fixtureinfo.arg2fixturedefs
fixtures.add_funcarg_pseudo_fixture_def(self, metafunc, fm)
Expand Down Expand Up @@ -1457,7 +1459,7 @@ def __init__(
#: parametrization adds a ``"[...]"`` suffix to function names).
#:
#: .. versionadded:: 3.0
self.originalname = originalname if originalname is not None else name
self.originalname = originalname

self.keywords.update(self.obj.__dict__)
self.own_markers.extend(get_unpacked_marks(self.obj))
Expand Down
2 changes: 1 addition & 1 deletion testing/python/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ def test_no_param():
]

def test_function_with_square_brackets(self, testdir: Testdir) -> None:
"""Check that Function._getobj uses originalname."""
"""Check that functions with square brackets don't cause trouble."""
p1 = testdir.makepyfile(
"""
locals()["test_foo[name]"] = lambda: None
Expand Down

0 comments on commit 773db73

Please sign in to comment.