Skip to content

CI: fix flaky isolated_filesystem failures in functional_test#141

Merged
ake2l merged 4 commits into
developmentfrom
ake2l-patch-1
Jun 2, 2026
Merged

CI: fix flaky isolated_filesystem failures in functional_test#141
ake2l merged 4 commits into
developmentfrom
ake2l-patch-1

Conversation

@ake2l

@ake2l ake2l commented Jun 2, 2026

Copy link
Copy Markdown
Member

Problem

Four tests_ce/functional_tests/test_cli/test_cli.py tests were failing in CI with:

AttributeError: 'CliRunner' object has no attribute 'isolated_filesystem'

All four tests use runner.isolated_filesystem() (a click.testing.CliRunner context manager). The 16 other tests in the same file — same runner = CliRunner() instance, just no isolated_filesystem call — all passed. Tests pass locally with the same pinned versions (click 8.2.1, typer 0.16.0), and every click version from 7.1.2 → 8.4.1 ships the method, so this is a CI-environment issue, not a code or version-spec issue.

Changes

  1. Robust test rewrite (primary fix). Replaced runner.isolated_filesystem() with pytest's standard tmp_path + monkeypatch.chdir(tmp_path) in the 4 affected tests. Same isolation guarantee, no dependency on click's testing surface, more idiomatic.

  2. Cache-key correctness. The .venv cache key in .github/workflows/main.yml hashed only pyproject.toml. Since transitive deps live in uv.lock, lock-only updates couldn't invalidate the cached venv. Updated all 9 cache key references to:

    key: ${{ runner.os }}-python-${{ hashFiles('./pyproject.toml', './uv.lock') }}
  3. Diagnostic step added to functional_test that prints click/typer versions, file paths, CliRunner MRO, and hasattr(runner, 'isolated_filesystem'), plus uv pip list | grep click|typer. Leaves a trail so we can pinpoint the underlying CI env issue (likely a partial/corrupt restored .venv) without it blocking the build.

Verification

  • All 20 tests in test_cli.py pass locally.
  • Refactored tests use only tmp_path + monkeypatch.chdir, which doesn't depend on the broken surface area.

Follow-up

Once the diagnostic step runs in CI we'll know whether the restored .venv has the expected click version. If it turns out cache corruption is real, we should consider either dropping the cache entirely or running uv sync --frozen in each test job rather than trusting the cached .venv.

ake2l added 4 commits June 2, 2026 10:16
remove the MR stage
Cache key only hashed pyproject.toml, so lockfile-only dependency
updates restored a stale .venv across runs.
…ch.chdir

Avoids depending on click.testing.CliRunner.isolated_filesystem, which
is failing to resolve on the CI container despite click 8.2.1 having
it. Standard pytest fixtures are more idiomatic and avoid the issue.
@ake2l ake2l changed the title Update main.yml CI: fix flaky isolated_filesystem failures in functional_test Jun 2, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@ake2l ake2l merged commit c75e5ae into development Jun 2, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant