← Back to issue list

Integration tests are slow due to fixture ordering

View original Github issue

Metadata

Project
craft-providers
Number
#312
Type
issue
State
open
Author
mr-cal
Labels
Type: Enhancement
Created
Updated
Closed
—

Current evaluation

Enhancement: integration tests provision LXD instances before the installed_snap fixture can skip, wasting time; current test_snap_installer.py signatures still list core22_lxd_instance first. Unaddressed.

Suggested action: keep open

Reason: The problem still exists at HEAD: tests/integration/actions/test_snap_installer.py:30 declares `def test_inject_from_host(core22_lxd_instance, installed_snap, caplog)`, and conftest.py:247 calls `pytest.skip(f"{snap_name!r} snap not installed, skipped")` only after the instance is created. The author's concrete example and referenced permalink are still valid, and the issue is a legitimate maintainer-filed enhancement (label "Type: Enhancement") with no resolution in git history for test_snap_installer.py since 511996d. Confidence is moderated because a naive fixture reorder may not achieve the stated goal: installed_snap is a session-scoped factory fixture that returns a contextmanager, so the skip fires on `with installed_snap(...)` entry (when the snap name is known), not during fixture setup — the fixture would need to take the snap name eagerly for reordering to help.

Evaluated by: mr-cal-bot

Impact: 32 Quick Win: 14 Complexity: 30 Confidence: 76 Actionability: 62

Issue body

The integration tests could be sped up by thoughtfully re-ordering the fixtures. For example: https://github.com/canonical/craft-providers/blob/427870dbea055f13dd38c92c203983e0fb16b8f6/tests/integration/actions/test_snap_installer.py#L26 First, `core20_lxd_instance` creates a LXD instance (which takes a long time), then `installed_snap` checks for the envvar `CRAFT_PROVIDERS_TESTS_ENABLE_SNAP_INSTALL`. If that envvar isn't true, then the test is skipped. If `installed_snap` is the first fixture, the test could be skipped much quicker.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 32
Quick Win: 14
Complexity: 30
Confidence: 76
Actionability: 62
keep open Enhancement: integration tests provision LXD instances before the installed_snap fixture can skip, wasting time; current test_snap_installer.py signatures still list core22_lxd_instance first. Unaddressed.
stealth/space-bunny-alpha
Impact: 35
Quick Win: 19
Complexity: 35
Confidence: 90
Actionability: 82
keep open Open enhancement to move snap-availability checks before costly LXD provisioning in integration tests; current fixture signatures still provision the instance first.
qwen3.6-35b-a3b-mtp-q6
Impact: 40
Quick Win: 34
Staleness: 70
Complexity: 15
Confidence: 65
Support Request: 0
keep open Enhancement to reorder integration test fixtures for faster test execution by skipping early when snap installation is disabled
qwen/qwen3.6-35b-a3b
Staleness: 70
Complexity: 15
Confidence: 85
Support Request: 0
keep open Suggests reordering test fixtures to skip slow integration tests faster when environment conditions are not met. Open enhancement with no maintainer comments or activity in over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 15
Confidence: 85
Support Request: 0
keep open Optimizing integration test speed by reordering pytest fixtures to skip slow setup steps earlier. Open for ~3 years with recent activity, awaiting implementation.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.