Skip to content

[tests] guard peft imports in test_lora_loader_utils - #14434

Merged
sayakpaul merged 1 commit into
mainfrom
fix-hub-tests-peft-import
Aug 10, 2026
Merged

[tests] guard peft imports in test_lora_loader_utils#14434
sayakpaul merged 1 commit into
mainfrom
fix-hub-tests-peft-import

Conversation

@sayakpaul

@sayakpaul sayakpaul commented Aug 10, 2026

Copy link
Copy Markdown
Member

The Hub staging-tests job runs `pytest -m "is_staging_test" tests`, which
imports every test module at collection time, but that job doesn't install
peft. The top-level `from peft import ...` added in #14385 therefore breaks
collection with exit code 2 on every PR.

Guard the imports behind `is_peft_available()` (as `tests/lora/utils.py`
already does) and mark the one test that needs them with
`require_peft_backend`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added size/S PR with diff < 50 LOC tests labels Aug 10, 2026
@sayakpaul
sayakpaul merged commit f6e1c4d into main Aug 10, 2026
13 of 14 checks passed
@sayakpaul
sayakpaul deleted the fix-hub-tests-peft-import branch August 10, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR with diff < 50 LOC tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants