Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not run with Python 3.11-dev #9181

Closed
scop opened this issue Oct 8, 2021 · 7 comments
Closed

Does not run with Python 3.11-dev #9181

scop opened this issue Oct 8, 2021 · 7 comments

Comments

@scop
Copy link
Contributor

scop commented Oct 8, 2021

With 6.2.5 and current git main:

$ python3.11 -V
Python 3.11.0a1+
$ python3.11 -m pytest
Traceback (most recent call last):
  File "/home/scop/.pyenv/versions/pytest311/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 145, in __makeattr
    modpath, attrname = self.__map__[name]
                        ~~~~~~~~~~~~^^^^^^
KeyError: '__spec__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/scop/.pyenv/versions/3.11-dev/lib/python3.11/runpy.py", line 187, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/.pyenv/versions/3.11-dev/lib/python3.11/runpy.py", line 146, in _get_module_details
    return _get_module_details(pkg_main_name, error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/.pyenv/versions/3.11-dev/lib/python3.11/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
    ^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/Documents/code/pytest/src/pytest/__init__.py", line 3, in <module>
    from . import collect
    ^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/Documents/code/pytest/src/pytest/collect.py", line 8, in <module>
    from _pytest.deprecated import PYTEST_COLLECT_MODULE
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/Documents/code/pytest/src/_pytest/deprecated.py", line 13, in <module>
    from _pytest.warning_types import PytestDeprecationWarning
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/Documents/code/pytest/src/_pytest/warning_types.py", line 8, in <module>
    from _pytest.compat import final
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/Documents/code/pytest/src/_pytest/compat.py", line 39, in <module>
    LEGACY_PATH = py.path. local
                  ^^^^^^^^^^^^^^
  File "/home/scop/.pyenv/versions/pytest311/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 152, in __makeattr
    result = importobj(modpath, attrname)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/scop/.pyenv/versions/pytest311/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 72, in importobj
    module = __import__(modpath, None, None, ['__doc__'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1083, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1043, in _find_and_load_unlocked
  File "/home/scop/.pyenv/versions/pytest311/lib/python3.11/site-packages/py/_vendored_packages/apipkg/__init__.py", line 150, in __makeattr
    raise AttributeError(name)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: __spec__
@RonnyPfannschmidt
Copy link
Member

This is already fixed in pylib, we need to re vendor apipkg and give it a release

@henryiii
Copy link

This is affecting pybind/pybind11#3368 and pypa/build#376, so would be much appreciated :). Would you like me to make a PR to add it to your test matrix?

@hugovk
Copy link
Member

hugovk commented Oct 16, 2021

A new release of py is needed: pytest-dev/py#273.

In the meantime, you could try installing py directly from GitHub?

@henryiii
Copy link

Latest git py works! Thanks, that’s an acceptable solution for an alpha release of Python. :)

scop added a commit to scop/hashpipe that referenced this issue Oct 19, 2021
Up to 1.10.0 don't work with Python 3.11, causing pytest not to work.

Refs pytest-dev/pytest#9181
scop added a commit to scop/hashpipe that referenced this issue Oct 19, 2021
Up to 1.10.0 don't work with Python 3.11, causing pytest not to work.

Refs pytest-dev/pytest#9181
scop added a commit to scop/hashpipe that referenced this issue Oct 19, 2021
Up to 1.10.0 don't work with Python 3.11, causing pytest and tox not to
work.

Refs pytest-dev/pytest#9181
scop added a commit to scop/hashpipe that referenced this issue Oct 19, 2021
Up to 1.10.0 don't work with Python 3.11, causing pytest and tox not to
work.

Refs pytest-dev/pytest#9181
scop added a commit to scop/hashpipe that referenced this issue Oct 19, 2021
Up to 1.10.0 don't work with Python 3.11, causing pytest and tox not to
work.

Refs pytest-dev/pytest#9181
Refs tox-dev/tox#2249
scop added a commit to scop/hashpipe that referenced this issue Oct 19, 2021
Up to 1.10.0 don't work with Python 3.11, causing pytest and tox not to
work.

Refs pytest-dev/pytest#9181
Refs tox-dev/tox#2249
scop added a commit to scop/pytekukko that referenced this issue Oct 19, 2021
Use post 1.10.0 py snapshot to fix pytest and tox issues when the "host"
Python is 3.11 too.

Refs pytest-dev/pytest#9181
Refs tox-dev/tox#2249
asrashley added a commit to asrashley/music-bingo that referenced this issue Dec 16, 2022
asrashley added a commit to asrashley/music-bingo that referenced this issue Dec 18, 2022
The github action to run tests fails on Python 3.11 due to assert
failures for an enum not being correctly passed into a function
that uses functions defined for that enum.

pytest-dev/pytest#9181
asrashley added a commit to asrashley/music-bingo that referenced this issue Dec 18, 2022
The github action to run tests fails on Python 3.11 due to assert
failures for an enum not being correctly passed into a function
that uses functions defined for that enum.

pytest-dev/pytest#9181
@montykamath
Copy link

i still get this error with python 3.11.2. any idea how to fix it? i'm using python 3.11.2 and pytest 7.2.1

@davidism
Copy link

Open a new issue with a minimal reproducible example if you're having a problem. Commenting "this still happens" with no additional details on a two year old closed issue isn't helpful.

@sparrowt
Copy link

sparrowt commented Apr 18, 2023

Do you have an old version of the package py installed inadvertently? (pip show py)

If so then:

  • if you definitely still need py then upgrade it to 1.11.0
  • it might be that you no longer need py at all:
    • for me it was left over from having been required by older version of pytest
    • pytest 7.2.0 removed py as a dependency "but will use the py library if it is installed"
    • so if you don't need it for anything else, simply remove it from your env: pip uninstall py & pytest will start working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants