You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Correct two stale descriptions in CLAUDE.md verified against source:
- Commands: `just test` runs without coverage (addopts is empty in
pyproject.toml); document `just test-ci` as the gated 100% line-coverage
run and `just test-branch` as test-ci plus --cov-branch.
- expose() is variadic `expose(*groups, ...)`, not single-group; note the
ValueError on duplicate attribute names across groups and the TypeError
on no groups.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
-`just lint-ci` — same checks in non-mutating mode (`--check`, `--no-fix`)
12
-
-`just test` — `uv run --no-sync pytest` (forwards extra args; `addopts` already adds `--cov=. --cov-report term-missing`)
13
-
-`just test-branch` — `pytest --cov-branch`
12
+
-`just test` — `uv run --no-sync pytest`, forwards extra args; no coverage (`addopts` is empty)
13
+
-`just test-ci` — gated run: coverage with `--cov-fail-under=100` (the 100% line-coverage gate)
14
+
-`just test-branch` — like `test-ci` plus `--cov-branch`
14
15
- Run a single test: `just test tests/test_expose.py::test_expose_generates_repo_fixture` (or `-k <expr>`)
15
16
- Type checker is `ty`; suppress with `# ty: ignore` (not `# type: ignore`)
16
17
@@ -19,7 +20,7 @@ This project uses `just` and `uv`. See `Justfile` for the source of truth.
19
20
This package is a thin pytest adapter over [`modern-di`](https://github.com/modern-python/modern-di). All implementation lives in `modern_di_pytest/factory.py` and exposes exactly two public symbols:
20
21
21
22
-`modern_di_fixture(dependency, *, container_fixture="di_container", name=None, pytest_scope="function")` — wraps a single type or `AbstractProvider` in a `@pytest.fixture`. At fixture time it calls `request.getfixturevalue(container_fixture)`, then dispatches: `AbstractProvider` → `container.resolve_provider(...)`, otherwise `container.resolve(...)`.
22
-
-`expose(group, *, container_fixture="di_container", pytest_scope="function", module=None)` — iterates `vars(group)`, and for each attribute that is an `AbstractProvider` instance, builds a `modern_di_fixture` and `setattr`s it onto the target module under the attribute's name. Non-Provider attributes (strings, ints, underscored, etc.) are silently skipped. When `module` is omitted, the caller's module is located via `inspect.stack()[1]` — `expose` therefore only works when called from module scope of a `conftest.py` / test module, not from inside a function.
23
+
-`expose(*groups, container_fixture="di_container", pytest_scope="function", module=None)` — variadic: accepts one or more `Group` subclasses. For each, iterates `vars(group)` and for every attribute that is an `AbstractProvider` instance, builds a `modern_di_fixture` and `setattr`s it onto the target module under the attribute's name. Non-Provider attributes (strings, ints, underscored, etc.) are silently skipped. A duplicate attribute name across the given groups raises `ValueError`; calling with no groups raises `TypeError`. When `module` is omitted, the caller's module is located via `inspect.stack()[1]` — `expose` therefore only works when called from module scope of a `conftest.py` / test module, not from inside a function.
23
24
24
25
Key contract: this package does **not** own the container. The user defines a `di_container` pytest fixture (any scope) that yields a `modern_di.Container`. Child-scoped containers (e.g. `REQUEST`) are accessed by passing a different `container_fixture=` name — see `tests/conftest.py` for the `di_container` / `di_request_container` pattern. Overrides are not re-implemented here; users call `Container.override()` / `reset_override()` directly.
0 commit comments