Closed glatterf42 closed 7 months ago
See https://docs.pytest.org/en/8.0.x/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path - i.e. ixmp
needs to use start_path
and not startdir
.
I just ran into this as well. Apparently, with version 7.0.0, startdir
got an alternative name start_path
, the idea being that startdir
is getting deprecated. If you look deeper into the 7.0.0 changelog, you can find an indication about the deprecation (https://docs.pytest.org/en/stable/deprecations.html#py-path-local-arguments-for-hooks-replaced-with-pathlib-path). Not sure why this was thrown out for 8.1.0 though, it's not listed in the changelog and isn't the idea to do backwards incompatible changes only in major version changes? The docu marks this as having been removed in 8.0, which is not the case.
Thanks, both :)
@robsan00 pytest's policy is add deprecation warning -> change deprecation warning to error by default on MAJOR.0 release -> completely remove on MAJOR.1 release. This is to give people one last chance to handle the deprecations. Probably your project suppresses warnings?
pytest's policy is add deprecation warning -> change deprecation warning to error by default on MAJOR.0 release -> completely remove on MAJOR.1 release. This is to give people one last chance to handle the deprecations. Probably your project suppresses warnings?
Policy notwithstanding, this issue arose because no such warning was ever added; only the mention in the change log. You can confirm this with the following in an empty directory:
conftest.py:
def pytest_report_header(config, startdir): # Old-style signature
print("Hello, world!")
test_all.py:
def test_nothing():
pass
With 7.4.4 <= pytest < 8.1, this runs and no warning is emitted. With 8.1.0, it errors.
Maybe it is technically infeasible or prohibitively complex for pytest to introspect every hookimpl and raise warnings; that's fair. Also fair to expect users to read the change log carefully once in a while. But one can't fault users for disregarding a non-existent warning.
i suspect we have a issue with pytest hooking into warnings, its possible the setup for warning capture is not completed at that point in time
@khaeru I think you are right, it seems that the warnings were issued when the hook is called with the deprecated arguments, but not when a hookimpl is defined accepting deprecated arguments. This is an omission that I didn't realize myself.
Thanks for your work and effort in maintaining pytest! Unfortunately, the release of v8.1.0 seems to break all our test suites (e.g. at ixmp and message_ix. I've tried to confirm this by updating just pytest locally in my venv and this did indeed break the tests locally as well. So I had:
And this lead to the following error and traceback:
And to confirm
Locally, I'm running this on Ubuntu 22.04 with Python 3.12, but as I said above, the exact same error occurs on all OS and from Python 3.8 through 3.12 in our CI.
The version of pluggy hasn't changed (neither on CI nor locally), same is true for ixmp, though that might be ill-configured so that the plugin is not properly registered. If that is the case, please let me know what we need to change on our end to accommodate v8.1.0 :)