Skip to content

Commit 62f5071

Browse files
committed
Revert "one approach"
This reverts commit 1ca1779.
1 parent 1ca1779 commit 62f5071

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

python/helpers/pycharm/teamcity/pytest_plugin.py

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -168,33 +168,6 @@ def format_location(self, location):
168168
return "%s:%s (%s)" % (str(location[0]), str(location[1]), str(location[2]))
169169
return str(location)
170170

171-
def _extract_short_message(self, report):
172-
"""Best-effort extraction of a short, user-meaningful failure message.
173-
Prefers pytest's reprcrash.message; falls back to the first non-empty
174-
line of the stringified long representation.
175-
"""
176-
try:
177-
longrepr = getattr(report, 'longrepr', None)
178-
# Prefer reprcrash.message when available (pytest longrepr objects)
179-
reprcrash = getattr(longrepr, 'reprcrash', None)
180-
msg = getattr(reprcrash, 'message', None) if reprcrash is not None else None
181-
if msg:
182-
return str(msg)
183-
except Exception:
184-
pass
185-
186-
# Fallback: first non-empty line from the longrepr text
187-
try:
188-
text = getattr(report, 'longrepr', '')
189-
for line in text.splitlines():
190-
s = line.strip()
191-
if s:
192-
return s
193-
except Exception:
194-
pass
195-
196-
return None
197-
198171
def pytest_sessionfinish(self, session, exitstatus):
199172
if exitstatus > pytest.ExitCode.TESTS_FAILED and self.current_test_item:
200173
test_id = self.format_test_id(self.current_test_item.nodeid, self.current_test_item.location)
@@ -268,11 +241,8 @@ def report_test_failure(self, test_id, report, message=None, report_output=True)
268241
else:
269242
duration = None
270243

271-
# Compute a concise display message which we pass separately from details
272-
short_msg = self._extract_short_message(report)
273244
if message is None:
274245
message = self.format_location(report.location)
275-
display_message = short_msg or message
276246

277247
self.ensure_test_start_reported(test_id)
278248
if report_output:
@@ -317,12 +287,12 @@ def report_test_failure(self, test_id, report, message=None, report_output=True)
317287
strace = strace[0:strace.index(data_postfix)].strip()
318288
if strace.endswith(":") and diff_error.real_exception:
319289
strace += " " + type(diff_error.real_exception).__name__
320-
self.teamcity.testFailed(test_id, diff_error.msg or display_message, strace,
290+
self.teamcity.testFailed(test_id, diff_error.msg or message, strace,
321291
flowId=test_id,
322292
comparison_failure=diff_error
323293
)
324294
else:
325-
self.teamcity.testFailed(test_id, display_message, str(report.longrepr), flowId=test_id)
295+
self.teamcity.testFailed(test_id, message, str(report.longrepr), flowId=test_id)
326296
self.report_test_finished(test_id, duration)
327297

328298
def report_test_skip(self, test_id, report):

0 commit comments

Comments
 (0)