Compare commits

...
5 Commits
Author SHA1 Message Date
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
498e75c624 ⬆ Bump codecov/codecov-action from 6 to 7 (#309)
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 6 to 7.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v6...v7)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-10 18:58:25 +02:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
541bfeb1a4 ⬆ Bump actions/checkout from 6 to 7 (#325)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-07-10 18:58:12 +02:00
d3vyceandGitHub c16909f585 fix: restore static type hints for FixtureRegistry, load_fixtures, load_fixtures_by_context lost in lazy-import refactor (#347) 2026-07-07 18:42:30 +02:00
d3vyceandGitHub c256e58d64 fix: batch_merge crashes with AnnotatedJoin has no attribute _autoincrement_column on joined-table inheritance (#345) 2026-07-07 18:22:13 +02:00
d3vyceandGitHub 040c023b8a feat: allow default context via FIXTURES_CONTEXT env var for fixtures load (#343) 2026-07-06 18:17:07 +02:00
7 changed files with 32 additions and 11 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
+5 -5
View File
@@ -18,7 +18,7 @@ jobs:
name: Lint (Ruff)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
@@ -39,7 +39,7 @@ jobs:
name: Type Check (ty)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
@@ -77,7 +77,7 @@ jobs:
--health-retries 5
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v7
@@ -96,7 +96,7 @@ jobs:
- name: Upload coverage to Codecov
if: matrix.python-version == '3.14'
uses: codecov/codecov-action@v6
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: coverage
@@ -105,7 +105,7 @@ jobs:
- name: Upload test results to Codecov
if: matrix.python-version == '3.14'
uses: codecov/codecov-action@v6
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
report_type: test_results
+1 -1
View File
@@ -11,7 +11,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
with:
fetch-depth: 0
+14
View File
@@ -68,6 +68,20 @@ manager fixtures --help
╰──────────────────────────────────────────────────────────────────────────────────╯
```
### `fixtures load`
```bash
manager fixtures load [CONTEXTS]... [--strategy merge|insert|skip_existing] [--dry-run]
```
`CONTEXTS` defaults to `Context.BASE` when omitted, and can also be set via the `FIXTURES_CONTEXT` environment variable, handy for CI/deploy scripts that shouldn't need an explicit argument per environment:
```bash
FIXTURES_CONTEXT=testing manager fixtures load
```
An explicit CLI argument always takes precedence over the environment variable.
## Custom CLI
You can extend the CLI by providing your own Typer app. The `manager` entry point will merge your app's commands with the built-in ones:
@@ -57,7 +57,7 @@ async def load(
ctx: typer.Context,
contexts: Annotated[
list[str] | None,
typer.Argument(help="Contexts to load."),
typer.Argument(help="Contexts to load.", envvar="FIXTURES_CONTEXT"),
] = None,
strategy: Annotated[
LoadStrategy,
@@ -1,7 +1,13 @@
"""Fixture system for seeding databases with dependency resolution."""
from typing import TYPE_CHECKING
from .enum import Context, LoadStrategy
if TYPE_CHECKING:
from .registry import FixtureRegistry
from .utils import load_fixtures, load_fixtures_by_context
__all__ = [
"Context",
"FixtureRegistry",
+4 -3
View File
@@ -139,12 +139,13 @@ async def _batch_merge(
) -> None:
"""UPSERT: insert new rows, update existing ones with the provided values."""
for cls, group_dicts, _ in _grouped_table_dicts(model_cls, instances):
pk_names = [col.name for col in cls.__table__.primary_key]
table = cast(Table, cls.__table__)
pk_names = [col.name for col in table.primary_key]
pk_names_set = set(pk_names)
own_col_keys = {col.key for col in cls.__table__.columns}
own_col_keys = {col.key for col in table.columns}
non_pk_cols = [k for k in own_col_keys if k not in pk_names_set]
stmt = pg_insert(cls).values(group_dicts)
stmt = pg_insert(table).values(group_dicts)
inserted_keys = set(group_dicts[0])
update_cols = [col for col in non_pk_cols if col in inserted_keys]