Skip to content

test: Migrate to pytest-lazy-fixtures#7761

Open
matthewelwell wants to merge 1 commit into
mainfrom
test/migrate-pytest-lazy-fixtures
Open

test: Migrate to pytest-lazy-fixtures#7761
matthewelwell wants to merge 1 commit into
mainfrom
test/migrate-pytest-lazy-fixtures

Conversation

@matthewelwell

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #7759

pytest-lazy-fixture 0.6.3 has been unmaintained since 2020 and is incompatible with pytest 8+ — it relies on pytest's internal CallSpec2.funcargs, removed in pytest 9, causing every test module that imports it to error at collection. This currently forces us to keep pytest capped below 8 (see #7756).

This PR migrates to the maintained pytest-lazy-fixtures fork:

  • Replaced pytest-lazy-fixture>=0.6.3,<0.7.0 with pytest-lazy-fixtures>=1.4.0,<2.0.0 in the dev extra, and dropped the pytest-lazy-fixture==0.6.3 entry from [tool.uv].override-dependencies.
  • Rewrote all ~300 lazy_fixture("name") call sites across 35 test files to the new lf("name") API. The change is purely mechanical — no test logic touched.
  • Removed the # type: ignore[import-untyped] comments on the imports, since pytest-lazy-fixtures ships type hints (py.typed).

The remaining acceptance criteria on #7759 (lifting the pytest<8 cap and removing the TODO markers) live on the #7756 branch and will be handled there once this is merged.

How did you test this code?

  • make typecheckSuccess: no issues found in 1697 source files.
  • Ran the full test set for every migrated file locally against the dev database: 1,872 passed, 7 skipped, 0 failures across three batches (unit permissions/api_keys/edge_api/sse, unit environments/projects/features/integrations/organisations/segments, and the migrated tests/integration modules).

pytest-lazy-fixture 0.6.3 has been unmaintained since 2020 and is
incompatible with pytest 8+ (it relies on `CallSpec2.funcargs`, removed
in pytest 9). Replace it with the maintained pytest-lazy-fixtures fork,
rewriting all `lazy_fixture("name")` call sites to `lf("name")`. The new
package ships type hints, so the `# type: ignore[import-untyped]`
comments on its imports are no longer needed.

This unblocks lifting the pytest version cap.

Closes #7759

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@matthewelwell matthewelwell requested a review from a team as a code owner June 11, 2026 16:22
@matthewelwell matthewelwell requested review from khvn26 and removed request for a team June 11, 2026 16:22
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Jun 11, 2026 4:22pm
flagsmith-frontend-preview Ignored Ignored Jun 11, 2026 4:22pm
flagsmith-frontend-staging Ignored Ignored Jun 11, 2026 4:22pm

Request Review

@github-actions github-actions Bot added the api Issue related to the REST API label Jun 11, 2026
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7761 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7761 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7761 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7761 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7761 Finished ✅ Results

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.40%. Comparing base (8a6c26b) to head (f98dc79).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7761      +/-   ##
==========================================
- Coverage   98.55%   98.40%   -0.16%     
==========================================
  Files        1454     1454              
  Lines       56000    55995       -5     
==========================================
- Hits        55193    55104      -89     
- Misses        807      891      +84     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.1 seconds
commit  f98dc79
info  🔄 Run: #17439 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  40.9 seconds
commit  f98dc79
info  🔄 Run: #17439 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  45.1 seconds
commit  f98dc79
info  🔄 Run: #17439 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  36.8 seconds
commit  f98dc79
info  🔄 Run: #17439 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tests: Migrate from unmaintained pytest-lazy-fixture to pytest-lazy-fixtures

2 participants