Test runner syntax error with Python 3.7
Answered
My project requires Python 3.7, but now all pytest run configurations are broken.
C:\Users\username\PycharmProjects\myproject\.venv\dj111-py37\Scripts\python.exe "C:/Program Files/JetBrains/PyCharm 2025.2.5/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py" --path C:\Users\username\PycharmProjects\myproject\mysite\tests\test_authentication.py
Testing started at 13:10 ...
Traceback (most recent call last):
File "C:/Program Files/JetBrains/PyCharm 2025.2.5/plugins/python-ce/helpers/pycharm/_jb_pytest_runner.py", line 20, in <module>
from teamcity import pytest_plugin
File "C:\Program Files\JetBrains\PyCharm 2025.2.5\plugins\python-ce\helpers\pycharm\teamcity\pytest_plugin.py", line 271
if m := re.search("AssertionError: Expected <(.*)> to .*? <(.*)>, but .*", err_message):
^
SyntaxError: invalid syntax
Process finished with exit code 1
Empty suite
Please sign in to leave a comment.
PyCharm 2025.2.5 and on supports Python 3 from the version 3.8 and on as mentioned here, and it shows that you're using an interpreter with version 3.7 on this project.
If updating the interpreter to a newer Python version is not possible as a workaround, you may install an older instance of the IDE using the Toolbox App to work on this specific project - For example - 2024.3 supports Python 3.7
Let me know if any questions or doubts or if you still face issues after that.
Is this real? In what world the IDE locks your project from having the Python version your project requires!? This sounds insane, there must be a workaround to run tests for my project…
Is there a post announcing dropping for python versions before 3.8?
Hi everyone, let me clarify what’s going on here.
PyCharm is not "locking" your project. PyCharm can open and edit any codebase regardless of its target Python version. The part that becomes a problem is running / debugging / executing tests inside the IDE, because those workflows rely on IDE helper tooling that must remain compatible with the configured interpreter.
Python 3.7 reached end-of-life on 2023-06-27 and no longer receives security updates. Because of that, newer PyCharm builds have moved on and do not support 3.7 interpreters.
We publish the supported interpreter range in the documentation (System requirements / Supported Languages). As of the current PyCharm documentation, supported Python 3 versions start at 3.9 (up to 3.15). So yes - versions “before 3.8” (and in fact, before 3.9 in current builds) are considered unsupported.
If your project must stay on Python 3.7, you have a few practical options:
- Use an older PyCharm version for this legacy project
- Run tests via the built-in Terminal (it works even when the interpreter is unsupported by the IDE). This won’t restore the full Test run integration for that interpreter, but it does let you execute the project’s real test suite without leaving PyCharm
From your link of supported languages:
> Python 2: version 2.7
This change also broke that. There is no `m:=` in python 2.7
This should be fixed by https://youtrack.jetbrains.com/issue/PY-86545/PyCharm-2025.3-pytest-runner-incompatible-with-Python-2.7