Skip to content

Commit 99bbd2e

Browse files
committed
Parse complete pytest output
1 parent 62f5071 commit 99bbd2e

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

python/helpers/pycharm/teamcity/pytest_plugin.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,16 +277,14 @@ def report_test_failure(self, test_id, report, message=None, report_output=True)
277277
diff_error = get_exception()
278278

279279
if diff_error:
280-
# Cut everything after postfix: it is internal view of DiffError
280+
# Keep full pytest traceback; do not truncate by underscore separators to avoid losing frames.
281281
strace = str(report.longrepr)
282-
data_postfix = "_ _ _ _ _"
283-
# Error message in pytest must be in "file.py:22 AssertionError" format
284-
# This message goes to strace
285-
# With custom error we must add real exception class explicitly
286-
if data_postfix in strace:
287-
strace = strace[0:strace.index(data_postfix)].strip()
288-
if strace.endswith(":") and diff_error.real_exception:
282+
# If the message ends with ":", append the real exception class for clarity.
283+
try:
284+
if strace.endswith(":") and getattr(diff_error, "real_exception", None):
289285
strace += " " + type(diff_error.real_exception).__name__
286+
except Exception:
287+
pass
290288
self.teamcity.testFailed(test_id, diff_error.msg or message, strace,
291289
flowId=test_id,
292290
comparison_failure=diff_error

0 commit comments

Comments
 (0)