Skip to content

Commit afac29e

Browse files
committed
refactor: remove unused code
1 parent e3b8fa3 commit afac29e

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/_pytest/assertion/rewrite.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
from _pytest._version import version
3232
from _pytest.assertion import util
3333
from _pytest.config import Config
34+
from _pytest.fixtures import getfixturemarker
3435
from _pytest.main import Session
3536
from _pytest.pathlib import absolutepath
3637
from _pytest.pathlib import fnmatch_ex
@@ -462,7 +463,7 @@ def _format_assertmsg(obj: object) -> str:
462463

463464
def _should_repr_global_name(obj: object) -> bool:
464465
if callable(obj):
465-
return hasattr(obj, "_fixture_function_marker")
466+
return getfixturemarker(obj) is not None
466467

467468
try:
468469
return not hasattr(obj, "__name__")

src/_pytest/fixtures.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,9 +1188,6 @@ def __init__(
11881188
):
11891189
self.name = fixture_function_marker.name or function.__name__
11901190
self.__name__ = self.name
1191-
# This attribute is used to check if an arbitrary python object is a fixture.
1192-
# Using isinstance on every object in code might execute code that is not intended to be executed.
1193-
# Like lazy loaded classes.
11941191
self._fixture_function_marker = fixture_function_marker
11951192
self._fixture_function = function
11961193
self._instance = instance

0 commit comments

Comments
 (0)