Skip to content

Commit b9759ea

Browse files
committed
refactor: remove unused code
1 parent 989f0f1 commit b9759ea

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
@@ -1194,9 +1194,6 @@ def __init__(
11941194
):
11951195
self.name = fixture_function_marker.name or function.__name__
11961196
self.__name__ = self.name
1197-
# This attribute is used to check if an arbitrary python object is a fixture.
1198-
# Using isinstance on every object in code might execute code that is not intended to be executed.
1199-
# Like lazy loaded classes.
12001197
self._fixture_function_marker = fixture_function_marker
12011198
self._fixture_function = function
12021199
self._instance = instance

0 commit comments

Comments
 (0)