[python] PY-86545 PyCharm 2025.3 pytest runner incompatible with Python 2.7

Remove syntax intended only for Python 3


Merge-request: IJ-MR-187224
Merged-by: Egor Eliseev <Egor.Eliseev@jetbrains.com>

GitOrigin-RevId: 9d452c16ec571800a693772a3ebed1ea004c4297
This commit is contained in:
Egor Eliseev
2026-01-08 13:27:43 +00:00
committed by intellij-monorepo-bot
parent 6946482179
commit 28de45318f
@@ -181,6 +181,8 @@ class EchoTeamCityMessages(object):
return str(location)
def pytest_sessionfinish(self, session, exitstatus):
if sys.version_info[0] == 2:
return
if exitstatus > pytest.ExitCode.TESTS_FAILED and self.current_test_item:
test_id = self.format_test_id(self.current_test_item.nodeid, self.current_test_item.location)
self.teamcity.testStopped(
@@ -272,7 +274,8 @@ class EchoTeamCityMessages(object):
left, right = right, left
diff_error = diff_tools.EqualsAssertionError(expected=right, actual=left)
else:
if m := re.search("AssertionError: Expected <(.*)> to .*? <(.*)>, but .*", err_message):
m = re.search("AssertionError: Expected <(.*)> to .*? <(.*)>, but .*", err_message)
if m:
left, right = m.group(1), m.group(2)
if self.swap_diff:
left, right = right, left