refactor: remove unused code

This commit is contained in:
Glyphack 2024-06-20 17:05:10 +02:00
parent a412a90e5d
commit efd0e0914e
2 changed files with 2 additions and 4 deletions

View File

@ -35,6 +35,7 @@ from _pytest._io.saferepr import saferepr
from _pytest._version import version
from _pytest.assertion import util
from _pytest.config import Config
from _pytest.fixtures import getfixturemarker
from _pytest.main import Session
from _pytest.pathlib import absolutepath
from _pytest.pathlib import fnmatch_ex
@ -462,7 +463,7 @@ def _format_assertmsg(obj: object) -> str:
def _should_repr_global_name(obj: object) -> bool:
if callable(obj):
return hasattr(obj, "_fixture_function_marker")
return getfixturemarker(obj) is not None
try:
return not hasattr(obj, "__name__")

View File

@ -1192,9 +1192,6 @@ class FixtureFunctionDefinition:
):
self.name = fixture_function_marker.name or function.__name__
self.__name__ = self.name
# This attribute is used to check if an arbitrary python object is a fixture.
# Using isinstance on every object in code might execute code that is not intended to be executed.
# Like lazy loaded classes.
self._fixture_function_marker = fixture_function_marker
self._fixture_function = function
self._instance = instance