From 28de45318fc56204afa8c84bb59a0d17d8ece35b Mon Sep 17 00:00:00 2001 From: Egor Eliseev Date: Thu, 8 Jan 2026 13:27:43 +0000 Subject: [PATCH] [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 GitOrigin-RevId: 9d452c16ec571800a693772a3ebed1ea004c4297 --- python/helpers/pycharm/teamcity/pytest_plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/helpers/pycharm/teamcity/pytest_plugin.py b/python/helpers/pycharm/teamcity/pytest_plugin.py index 68886ad346a4..84824caa04b7 100644 --- a/python/helpers/pycharm/teamcity/pytest_plugin.py +++ b/python/helpers/pycharm/teamcity/pytest_plugin.py @@ -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