Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 3 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #6546 +/- ##
==========================================
- Coverage 98.44% 98.38% -0.06%
==========================================
Files 1398 1397 -1
Lines 52654 52470 -184
==========================================
- Hits 51834 51622 -212
- Misses 820 848 +28 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- Convert api/pyproject.toml from poetry to PEP 621 + setuptools so the api becomes pip-installable (was package-mode = false). - Replace api/poetry.lock with api/uv.lock; pin every package to the exact version main was on (no silent upgrades). - Express each optional poetry group as a PEP 621 optional-dependencies extra (auth-controller, saml, ldap, workflows, licensing, release-pipelines) plus the existing dev extra.
b4057ee to
e5c67b4
Compare
Rewrite all api/Makefile targets that called poetry to use uv (install-uv, uv sync, uv run). Switch the python-typecheck pre-commit hook entry from 'poetry -C api run' to 'uv run' (executed inside api/), and replace the poetry-check hook with astral-sh/uv-pre-commit's uv-lock check. beep boop
Replace poetry installation and setup-python's cache:poetry option in the api workflows with astral-sh/setup-uv@v6 (cache keyed on api/uv.lock), and swap poetry-style --with group args for uv --extra extras when calling make install-packages. beep boop
Replace poetry-based install in build-python and build-python-private stages with uv sync. Translate --with X poetry group args to uv --extra flags and add UV_PROJECT_ENVIRONMENT, UV_PYTHON, UV_LINK_MODE config so the resulting venv lands at /build/.venv (the same layout the runtime stages copy from). beep boop
…ts/fixtures.py
The api conftest.py is shipped as a top-level `py-module` in the installed
wheel. Downstream consumers that install the api into their venv could not
re-use its fixtures via `from conftest import *` because their own root
`conftest.py` collides with the api's top-level `conftest` module.
Move every `@pytest.fixture` (and the helper constants they reference)
out of `api/conftest.py` into a regular module at `api/tests/fixtures.py`,
and have `api/conftest.py` re-export them with `from tests.fixtures import *`.
Pytest hooks (`pytest_addoption`, `pytest_configure`) stay in `api/conftest.py`
because pytest only invokes hooks from conftest / registered plugin modules.
Downstream consumers can now write:
# consumer's conftest.py
from tests.fixtures import * # noqa: F401, F403
without any importlib shenanigans.
- Ship api/tests/plugin.py as a pytest11 entry point so the api's --ci option and fixture set are auto-discovered by any venv with flagsmith-api[dev] installed. - Drop py-modules = ["conftest", "manage"]; api/conftest.py is gone (its hooks moved into the plugin). - Fixtures stay in api/tests/fixtures.py and get lazily registered in pytest_configure (after pytest-django has set up Django).
Drop the pytest11 entry point in favour of consumer-declared pytest_plugins = ["tests.conftest"]. Entry-point plugins are imported before pytest-django's tryfirst Django setup, which forced lazy fixture registration; declaring pytest_plugins in a consumer's rootdir conftest loads the plugin after pytest-django has run, so api/tests/conftest.py can keep its top-level Django imports. Collapses api/tests/plugin.py + api/tests/fixtures.py back into api/tests/conftest.py — one home for hooks and fixtures. Refs pytest-dev/pytest#935
The pyfakefs `fs` fixture computes its mount root via os.path.dirname(os.path.abspath(__file__)). When this fixture lived in api/conftest.py the root resolved to api/; after moving into api/tests/conftest.py the root regressed to api/tests/, which dropped api/app/templates/, api/users/templates/, etc. from the fake filesystem and caused TemplateDoesNotExist failures on pyfakefs-using tests.
…e branches The PR's diff includes the api/tests/conftest.py rewrite, which exposed pre-existing dead/defensive code to codecov/patch: - xero_subscription and manage_user_group_permission fixtures had no callers anywhere in the test suite, so delete them (also drops the XERO, MANAGE_USER_GROUPS, and OrganisationPermissionModel imports). - restrict_http_requests' inner urlopen_mock branches and the fs fixture's "site-packages outside api/" branch are defensive paths that only fire in environments the CI suite doesn't exercise; mark the specific lines (not the whole fixture) with `# pragma: no cover`.
3dab602 to
0796a91
Compare
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Docker builds report
|
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-16)Details
Playwright Test Results (oss - depot-ubuntu-latest-arm-16)Details
Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)Details
|
Visual Regression16 screenshots compared. See report for details. |
Let astral-sh/setup-uv install Python via python-version, and add BuildKit cache mounts on /root/.cache/uv to every Dockerfile stage that runs uv sync. beep boop
Why move to uv now
api/is a Poetry project withpackage-mode = false, so it isn't pip-installable. Downstream private packages (flagsmith-private,flagsmith-saml,flagsmith-workflows, ...) consume the api by cloning the repo and symlinking tests into it, each carrying its own copy of the api dependency graph.Migrating to uv + PEP 621 + setuptools makes the api a real, pip-installable package. Downstreams can list it as a
[tool.uv.sources]git dep and import normally.Testing gain
With the api installable, fixtures in
api/tests/conftest.pyare reachable from any consumer's venv. Consumers opt in withpytest_plugins = ["tests.conftest"]in their rootdir conftest and inherit every api fixture (project,feature,environment, ...) — no symlinks, no clones, no path tricks.Why the conftest refactor
api/conftest.pypreviously held hooks + fixtures. Two non-options for sharing it:conftestpy-module pollutes every downstream venv (collides with any project that has its own rootconftest.py).pytest11plugin doesn't work either: entry-point modules are imported before pytest-django'stryfirstDjango setup, so module-level Django imports explode withAppRegistryNotReady(see pytest #935).The fix: collapse hooks + fixtures into
api/tests/conftest.pyand have consumers opt in viapytest_plugins.pytest_pluginsresolves after pytest-django's Django setup, so module-level Django imports are safe.Locked versions
Every dep version in
uv.lockis byte-identical topoetry.lockonmain. No silent upgrades.Test plan
codecov/patchgreenflagsmith-privateconsumes the new package and inherits fixtures viapytest_plugins