refactor: remove unused code
This commit is contained in:
parent
a412a90e5d
commit
efd0e0914e
|
@ -35,6 +35,7 @@ from _pytest._io.saferepr import saferepr
|
||||||
from _pytest._version import version
|
from _pytest._version import version
|
||||||
from _pytest.assertion import util
|
from _pytest.assertion import util
|
||||||
from _pytest.config import Config
|
from _pytest.config import Config
|
||||||
|
from _pytest.fixtures import getfixturemarker
|
||||||
from _pytest.main import Session
|
from _pytest.main import Session
|
||||||
from _pytest.pathlib import absolutepath
|
from _pytest.pathlib import absolutepath
|
||||||
from _pytest.pathlib import fnmatch_ex
|
from _pytest.pathlib import fnmatch_ex
|
||||||
|
@ -462,7 +463,7 @@ def _format_assertmsg(obj: object) -> str:
|
||||||
|
|
||||||
def _should_repr_global_name(obj: object) -> bool:
|
def _should_repr_global_name(obj: object) -> bool:
|
||||||
if callable(obj):
|
if callable(obj):
|
||||||
return hasattr(obj, "_fixture_function_marker")
|
return getfixturemarker(obj) is not None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return not hasattr(obj, "__name__")
|
return not hasattr(obj, "__name__")
|
||||||
|
|
|
@ -1192,9 +1192,6 @@ class FixtureFunctionDefinition:
|
||||||
):
|
):
|
||||||
self.name = fixture_function_marker.name or function.__name__
|
self.name = fixture_function_marker.name or function.__name__
|
||||||
self.__name__ = self.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_marker = fixture_function_marker
|
||||||
self._fixture_function = function
|
self._fixture_function = function
|
||||||
self._instance = instance
|
self._instance = instance
|
||||||
|
|
Loading…
Reference in New Issue