Skip to content

Commit 71c9581

Browse files
committed
test: remove redundant test
1 parent bc0a0e5 commit 71c9581

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

src/_pytest/fixtures.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,15 +1742,13 @@ def parsefactories(
17421742
# The attribute can be an arbitrary descriptor, so the attribute
17431743
# access below can raise. safe_getattr() ignores such exceptions.
17441744
obj_ub = safe_getattr(holderobj_tp, name, None)
1745-
marker = getfixturemarker(obj_ub)
1746-
if not isinstance(marker, FixtureFunctionMarker):
1747-
# Magic globals with __getattr__ might have got us a wrong
1748-
# fixture attribute.
1749-
continue
1750-
if isinstance(obj, FixtureFunctionDefinition):
1745+
if isinstance(obj_ub, FixtureFunctionDefinition):
1746+
marker = getfixturemarker(obj_ub)
1747+
if marker is None:
1748+
raise Exception("marker was none")
17511749
if marker.name:
17521750
name = marker.name
1753-
func = obj_ub.get_real_func()
1751+
func = get_real_func(obj_ub)
17541752
self._register_fixture(
17551753
name=name,
17561754
nodeid=nodeid,

testing/code/test_source.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,6 @@ def deco_mark():
478478
def deco_fixture():
479479
assert False
480480

481-
# Since deco_fixture is now an instance of FixtureFunctionDef the getsource function will not work on it.
482-
with pytest.raises(TypeError, match=r"FixtureFunctionDefinition"):
483-
inspect.getsource(deco_fixture)
484481
src = inspect.getsource(deco_fixture._get_wrapped_function())
485482
assert src == " @pytest.fixture\n def deco_fixture():\n assert False\n"
486483
# Make sure the decorator is not a wrapped function

0 commit comments

Comments
 (0)