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

Support for Pytest 8.0 #737

Closed
blink1073 opened this issue Jan 2, 2024 · 14 comments · Fixed by #745 or #776
Closed

Support for Pytest 8.0 #737

blink1073 opened this issue Jan 2, 2024 · 14 comments · Fixed by #745 or #776
Assignees
Milestone

Comments

@blink1073
Copy link

blink1073 commented Jan 2, 2024

pytest 8.0.0rc1 was released today, and we're seeing a startup failure with pytest-asyncio:

https://github.com/jupyter/jupyter_events/actions/runs/7386335973/job/20092726210

============================= test session starts ==============================
platform linux -- Python 3.11.7, pytest-8.0.0rc1, pluggy-1.3.0 -- /home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/bin/python
cachedir: .pytest_cache
rootdir: /home/runner/work/jupyter_events/jupyter_events
configfile: pyproject.toml
testpaths: tests/
plugins: console-scripts-1.4.1, asyncio-0.23.3
asyncio: mode=Mode.AUTO
collecting ... collected 0 items
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/main.py", line 270, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>                          ^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/main.py", line 323, in _main
INTERNALERROR>     config.hook.pytest_collection(session=session)
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 113, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 96, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/logging.py", line 782, in pytest_collection
INTERNALERROR>     return (yield)
INTERNALERROR>             ^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 96, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/warnings.py", line 118, in pytest_collection
INTERNALERROR>     return (yield)
INTERNALERROR>             ^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 96, in _multicall
INTERNALERROR>     teardown.throw(exception)  # type: ignore[union-attr]
INTERNALERROR>     ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/config/__init__.py", line 1353, in pytest_collection
INTERNALERROR>     return (yield)
INTERNALERROR>             ^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/main.py", line 334, in pytest_collection
INTERNALERROR>     session.perform_collect()
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/main.py", line 761, in perform_collect
INTERNALERROR>     self.items.extend(self.genitems(node))
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/main.py", line 899, in genitems
INTERNALERROR>     rep, duplicate = self._collect_one_node(node, handle_dupes)
INTERNALERROR>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/main.py", line 787, in _collect_one_node
INTERNALERROR>     rep = collect_one_node(node)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/_pytest/runner.py", line 562, in collect_one_node
INTERNALERROR>     ihook.pytest_collectstart(collector=collector)
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_hooks.py", line 493, in __call__
INTERNALERROR>     return self._hookexec(self.name, self._hookimpls, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_manager.py", line 115, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 113, in _multicall
INTERNALERROR>     raise exception.with_traceback(exception.__traceback__)
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pluggy/_callers.py", line 77, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>           ^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNALERROR>   File "/home/runner/.local/share/hatch/env/virtual/jupyter-events/4vpRDyVj/test/lib/python3.11/site-packages/pytest_asyncio/plugin.py", line 626, in pytest_collectstart
INTERNALERROR>     pyobject = collector.obj
INTERNALERROR>                ^^^^^^^^^^^^^
INTERNALERROR> AttributeError: 'Package' object has no attribute 'obj'

============================ no tests ran in 0.01s =============================
@seifertm seifertm added this to the v0.24 milestone Jan 2, 2024
@seifertm
Copy link
Contributor

seifertm commented Jan 4, 2024

Thanks. Unfortunately, pytest-asyncio doesn't properly limit the maximum pytest version.

Pytest 8 introduces changes to the collection phase. Since it's a bit more effort for pytest-asyncio to accommodate those, I plan to temporarily exclude pytest>=8 from the compatible versions in a (post?) release. This doesn't resolve the issue, but it will prevent users from installing incompatible versions of pytest and pytest-asyncio.

@blink1073
Copy link
Author

Understood, thank you!

seifertm added a commit to seifertm/pytest-asyncio that referenced this issue Jan 9, 2024
Pytest 8 made some changes to its test collection and pytest-asyncio currently isn't compatible with those changes.
see pytest-dev#737

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
github-merge-queue bot pushed a commit that referenced this issue Jan 9, 2024
Pytest 8 made some changes to its test collection and pytest-asyncio currently isn't compatible with those changes.
see #737

Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
@seifertm seifertm reopened this Jan 9, 2024
@seifertm
Copy link
Contributor

seifertm commented Jan 9, 2024

pytest-asyncio v0.23.4a0 adds a maximum pytest version (pytest<8) to install_requires in setup.cfg. This should solve the issues in your CI that tests pre-release versions.

What's still left is to add actual support for pytest 8.

@blink1073
Copy link
Author

@dolfinus
Copy link

@seifertm Could you please release 0.23.4? pytest 8.0 was just released, and users got errors while using pytest-asyncio, see #763

@4danmi
Copy link

4danmi commented Jan 28, 2024

@seifertm Can we please release an hofix?

@seifertm
Copy link
Contributor

@dolfinus @4danmi pytest-asyncio-0.23.4 is released. It contains a proper upper bound for the pytest version, so that it doesn't get installed with pytest 8.

andrey18106 added a commit to nextcloud/app_api that referenced this issue Feb 1, 2024
* added URL encoding for Docker Container Pull action
* added two logs with `info` level for PullImage action
* removed "optional API Scope" support
* added AppAPI options toggles in Admin settings
* added RestartPolicy option to created containers

CI fails unrelated:
pytest-dev/pytest-asyncio#737

---------

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
Co-authored-by: Andrey Borysenko <andrey18106x@gmail.com>
Co-authored-by: Nextcloud bot <bot@nextcloud.com>
Co-authored-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
FloLey pushed a commit to inmanta/inmanta-dev-dependencies that referenced this issue Feb 2, 2024
@seifertm seifertm self-assigned this Feb 6, 2024
@seifertm seifertm modified the milestones: v0.24, v0.23 Feb 6, 2024
@seifertm
Copy link
Contributor

seifertm commented Feb 6, 2024

@analog-cbarber I saw that you already opened conda-forge/pytest-asyncio-feedstock#41 and it looks your issue has been resolved already.

The feedstock is the correct place to report these kind of issues. I'm happy to help from the pytest-asyncio side, but none of the pytest-asyncio developers maintain the conda feedstock.

@analog-cbarber
Copy link

@analog-cbarber I saw that you already opened conda-forge/pytest-asyncio-feedstock#41 and it looks your issue has been resolved already.

The feedstock is the correct place to report these kind of issues. I'm happy to help from the pytest-asyncio side, but none of the pytest-asyncio developers maintain the conda feedstock.

Probably a good idea for one of the pytest-asyncio maintainers to sign on to maintain the conda feedstock so you don't get surprised by this kind of thing. It usually is not that much work.

@seifertm
Copy link
Contributor

seifertm commented Feb 6, 2024

Apparently, the compatibility issues weren't as big in v0.23.4 as they were initially in the v0.23 releases.

Thanks to the investigation by @mgorny and the subsequent PR submitted by @akeeman there's now a pre-release of pytest-asyncio with pytest 8 support.

Version v0.23.5a0 does not contain code changes compared to v0.23.4, apart from fixes to the type annotations. Unless there are any unexpected issues, I'll tag a proper patch release by the end of the week.

@seifertm
Copy link
Contributor

seifertm commented Feb 9, 2024

There were no reports related to issues of pytest-asyncio-0.23.5a0 and pytest 8. There area lot of people wanting to upgrade and there were no significant changes required for pytest 8 support. Therefore, I tagged v0.23.5.

Thanks!

@mgorny
Copy link
Contributor

mgorny commented Feb 9, 2024

Thanks!

For the record, Gentoo's been patching the pytest-8 support in since 2024-02-06, and we've had no issues reported so far.

frebib added a commit to spritsail/drone-notify that referenced this issue Mar 19, 2024
Upstream issue was closed
pytest-dev/pytest-asyncio#737

Signed-off-by: Joe Groocock <me@frebib.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants