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

test: pytest: use collection_path argument #21026

Closed
wants to merge 1 commit into from

Conversation

jelly
Copy link
Member

@jelly jelly commented Sep 20, 2024

The path argument is deprecated since pytest 7 and an additional argument collection_path is now available.

This silences the deprecation warning on pytest 8.

@jelly
Copy link
Member Author

jelly commented Sep 20, 2024

Needs work:

============================= test session starts ==============================
platform linux -- Python 3.13.0a4, pytest-8.3.3, pluggy-1.5.0
cachedir: /tmp/.tox/py313-pytest/.pytest_cache
rootdir: /__w/cockpit/cockpit
configfile: pyproject.toml
testpaths: test/pytest
plugins: timeout-2.3.1, asyncio-0.24.0, xdist-3.6.1, cov-5.0.0
asyncio: mode=Mode.STRICT, default_loop_scope=None
collected 0 items / 1 error

==================================== ERRORS ====================================
_________________________ ERROR collecting test/pytest _________________________
/tmp/.tox/py313-pytest/lib/python3.13/site-packages/pluggy/_hooks.py:513: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/tmp/.tox/py313-pytest/lib/python3.13/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
test/pytest/conftest.py:39: in pytest_ignore_collect
    return collection_path.basename == 'test_browser.py' or None
E   AttributeError: 'PosixPath' object has no attribute 'basename'
=========================== short test summary info ============================
ERROR test/pytest - AttributeError: 'PosixPath' object has no attribute 'basename'

@jelly jelly added the no-test For doc/workflow changes, or experiments which don't need a full CI run, label Sep 20, 2024
The path argument is deprecated since pytest 7 and an additional
argument collection_path is it's replacement. It has slightly different
semantics as it returns a PosixPath.

This silences the deprecation warning on pytest 8.
@martinpitt
Copy link
Member

debian-stable has pytest 7, so that should be fine. ubuntu-2204 still has pytest 6.2 though. I triggered ubuntu-2204/other to check. (plus the required fcos).

If this goes green, then 👍 of course. Otherwise we can discuss if/when to drop support for 22.04 LTS.

@martinpitt
Copy link
Member

@jelly Dang! https://cockpit-logs.us-east-1.linodeobjects.com/pull-21026-9d4e7d74-20240923-075622-ubuntu-2204-other/log.html

Can we make this conditional? Or should we just block this until we drop 22.04 support?

@jelly
Copy link
Member Author

jelly commented Sep 23, 2024

This is blocked, Ubuntu 2204 has Pytest 6 so we can't use newer code yet.

Yes, I would not make it conditional. This will be removed in Pytest 9, last release is 8.3.3. So I am not too unhappy with keeping it this way for a while.

@jelly jelly closed this Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-test For doc/workflow changes, or experiments which don't need a full CI run,
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants