Skip to content

Commit 4a1628a

Browse files
committed
Revert "fix circular imports"
This reverts commit 85a813b.
1 parent 31b47d7 commit 4a1628a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/_pytest/compat.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
import _pytest
2727
from _pytest._io.saferepr import saferepr
28+
from _pytest.outcomes import fail
29+
from _pytest.outcomes import TEST_OUTCOME
2830

2931
if sys.version_info < (3, 5, 2):
3032
from typing_extensions import TYPE_CHECKING
@@ -152,8 +154,6 @@ def getfuncargnames(
152154
try:
153155
parameters = signature(function).parameters
154156
except (ValueError, TypeError) as e:
155-
from _pytest.outcomes import fail
156-
157157
fail(
158158
"Could not determine arguments of {!r}: {}".format(function, e),
159159
pytrace=False,
@@ -332,12 +332,8 @@ def safe_getattr(object: Any, name: str, default: Any) -> Any:
332332
"""
333333
try:
334334
return getattr(object, name, default)
335-
except BaseException as exc:
336-
from _pytest.outcomes import TEST_OUTCOME
337-
338-
if isinstance(exc, TEST_OUTCOME):
339-
return default
340-
raise
335+
except TEST_OUTCOME:
336+
return default
341337

342338

343339
def safe_isclass(obj: object) -> bool:

0 commit comments

Comments
 (0)