CI: Fix issues caused by pytest v9 #2904
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issues with pyproject.toml
Since the recent pytest v9 release, PEFT's
pyproject.tomldoes not work anymore. This is because it mixes both new and old format new formats (ini_options), which is no longer allowed.This PR fixes the issue by switching fully to the new format. Note that if a pytest version < 9.0.0 is used, the added pytest options will be ignored. Thus please update to 9.0.0+.
Context: https://github.com/pytest-dev/pytest/releases/tag/9.0.0
Example of failing CI: https://github.com/huggingface/peft/actions/runs/19218760387/job/54932519290#step:5:14
Issues with
unittest.skipSince pytest v9,
unittest.skipraises an error instead of just skipping the corresponding test (see these errors). As of writing this, it is unclear if this will be fixed or not:pytest-dev/pytest#13895
To avoid the error, we now use
pytest.mark.skipinsted ofunittest.skip/unittest.skipUnless.Tangential changes
unittest.TestCasethat were unnecessarytest_gpu_examples.pymodule if no accelerator is available (faster than checking each class/function individually)