Skip to content

Conversation

@matthewelwell
Copy link
Contributor

@matthewelwell matthewelwell commented Dec 8, 2025

Changes

Factors out the SKIP_MIGRATION_TESTS logic into a custom migrator fixture. This PR is being introduced because one of the tests in the tests/unit/features/test_migrations.py file didn't have the pytest mark decorator. This change also prevents this from occurring again when adding new migration tests.

I've also included some bonus removals of type: ignore statements since I was working in the area.

How did you test this code?

Ran the following 2 example test commands and verified that the tests were / weren't skipped when I expected.

SKIP_MIGRATION_TESTS=true make test opts="-n 0 --dist worksteal tests/unit/features/test_migrations.py"
SKIP_MIGRATION_TESTS=false make test opts="-n 0 --dist worksteal tests/unit/features/test_migrations.py"

@matthewelwell matthewelwell requested a review from a team as a code owner December 8, 2025 16:06
@matthewelwell matthewelwell requested review from gagantrivedi and removed request for a team December 8, 2025 16:06
@vercel
Copy link

vercel bot commented Dec 8, 2025

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

3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
docs Ignored Ignored Preview Dec 9, 2025 2:49pm
flagsmith-frontend-preview Ignored Ignored Preview Dec 9, 2025 2:49pm
flagsmith-frontend-staging Ignored Ignored Preview Dec 9, 2025 2:49pm

@github-actions github-actions bot added api Issue related to the REST API testing labels Dec 8, 2025
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the final PR Bugbot will review for you during this billing cycle

Your free Bugbot reviews will reset on December 10

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Docker builds report

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

@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.02%. Comparing base (f7ca9cd) to head (f8a8805).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6387   +/-   ##
=======================================
  Coverage   98.02%   98.02%           
=======================================
  Files        1282     1282           
  Lines       45498    45498           
=======================================
+ Hits        44600    44601    +1     
+ Misses        898      897    -1     

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it safe to assume all migration tests use the migrator fixture? In that case, consider redefining it in the root conftest.py module like so:

def migrator(request: pytest.FixtureRequest) -> Migrator:
   if settings.SKIP_MIGRATION_TESTS:
      pytest.skip("reason...")
   return request.getfixturevalue("migrator")

@matthewelwell
Copy link
Contributor Author

Is it safe to assume all migration tests use the migrator fixture? In that case, consider redefining it in the root conftest.py module like so:

def migrator(request: pytest.FixtureRequest) -> Migrator:
   if settings.SKIP_MIGRATION_TESTS:
      pytest.skip("reason...")
   return request.getfixturevalue("migrator")

Nice idea!

@github-actions github-actions bot added testing and removed testing labels Dec 9, 2025
@github-actions github-actions bot added testing and removed testing labels Dec 9, 2025
@github-actions github-actions bot added testing and removed testing labels Dec 9, 2025
@github-actions github-actions bot added testing and removed testing labels Dec 9, 2025
@github-actions github-actions bot added testing and removed testing labels Dec 9, 2025
Copy link
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noice.

image

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.

3 participants