I'm trying to execute some pytest tests on a python repo in pycharm. I've tried just executing the tests individually from command line but I get the same errors.
I'm using python and my python interpreter is set to 3.11
/usr/local/bin/python3.11 /Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py --path /Users/shannonj/Downloads/requests-master/tests
Testing started at 1:38 AM ...
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg.py", line 141, in __makeattr
modpath, attrname = self.__map__[name]
~~~~~~~~~~~~^^^^^^
KeyError: '__spec__'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_pytest_runner.py", line 5, in <module>
import pytest
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pytest/__init__.py", line 5, in <module>
from _pytest.assertion import register_assert_rewrite
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/assertion/__init__.py", line 9, in <module>
from _pytest.assertion import rewrite
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/assertion/rewrite.py", line 34, in <module>
from _pytest.assertion import util
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/assertion/util.py", line 13, in <module>
import _pytest._code
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/_code/__init__.py", line 2, in <module>
from .code import Code
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/_code/code.py", line 54, in <module>
class Code:
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/_pytest/_code/code.py", line 81, in Code
def path(self) -> Union[py.path.local, str]:
^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg.py", line 148, in __makeattr
result = importobj(modpath, attrname)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg.py", line 69, in importobj
module = __import__(modpath, None, None, ['__doc__'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1136, in _find_and_load_unlocked
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/py/_vendored_packages/apipkg.py", line 146, in __makeattr
raise AttributeError(name)
AttributeError: __spec__
Process finished with exit code 1
Empty suite
The requirements of the repo are as follows:
alabaster==0.7.7
Babel==2.2.0
coverage==5.0.3
decorator==4.0.9
docutils==0.12
Flask==0.10.1
httpbin==0.5.0
itsdangerous==0.24
Jinja2==2.10.3
MarkupSafe==1.1.0
pluggy==0.13.0
py==1.8.2
Pygments==2.1.1
PySocks==1.7.0
pytest-cov==2.4.0
pytest-httpbin==0.2.0
pytest-mock==0.11.0
pytest==6.2.5
pytz==2015.7
six==1.10.0
snowballstemmer==1.2.1
sphinx-rtd-theme==0.1.9
Sphinx==1.3.5
urllib3==1.26.7
Werkzeug==0.11.4
wheel==0.29.0
Which does seem pretty outdated. So I'm haphazarding a guess that maybe I need an older version of python? But I already have 3.11 and 3.12.2 installed via python.org's official mac installer. Older outdated versions of python don't have such an easy install option, though I guess I could use brew? I just don't want to mess with my default python version and I also don't know if it'll work.
I've tried updating some of packages, like py to the latest version 1.10, but it kind of sets off a chain of needing to update other packages.
Any insights would be appreciated