Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/content/docs/guides/testing/create-fixtures.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,18 @@ def localstack():
...
```

When a fixture file declares dependencies, `tenzir-test` installs them with
`uv` before importing project fixtures:
When a fixture file declares dependencies, `tenzir-test` installs missing
packages into the active Python environment with `uv` before importing project
fixtures:

```sh
uv pip install --python <current-python> boto3
```

If a bare dependency name, such as `boto3`, is already installed, the harness
reuses it instead of running `uv pip install`. Versioned requirements, such as
`boto3>=1.34`, still use `uv` so the requested version is enforced.

This works for `fixtures.py` and for any Python module under `fixtures/`,
including nested modules imported by `fixtures/__init__.py`. The feature also
applies in standalone fixture mode, such as `uvx tenzir-test --fixture
Expand All @@ -187,6 +192,12 @@ fixture imports an undeclared package, `tenzir-test` still reports the missing
dependency and suggests running the harness from a project environment or with
`uvx --with`.

Pass `--disable-inline-dependency-install`, or set
`TENZIR_TEST_DISABLE_INLINE_DEPENDENCY_INSTALL=1`, when another tool, such as
Nix, provisions all fixture dependencies and `tenzir-test` should not install
packages at runtime. The harness still reads dependency metadata, but fixture
imports can fail if the dependency is not actually available.

## Use container runtime helpers

When a fixture manages a single container directly rather than orchestrating
Expand Down
6 changes: 6 additions & 0 deletions src/content/docs/reference/test-framework/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ Useful options:
- `--no-hooks`: Disable project hook loading and invocation. Use this when you
need to recover from a broken hook or compare behavior without hook side
effects.
- `--disable-inline-dependency-install`: Disable runtime installation for
inline Python dependencies declared by tests or fixtures. Use this when
another tool provisions the Python environment.

Set `TENZIR_TEST_DEBUG=1` in CI when you want the same diagnostics without
passing `--debug` on the command line.
Expand Down Expand Up @@ -1229,6 +1232,9 @@ walks through the full implementation.
`--debug`).
- `TENZIR_TEST_DISABLE_HOOKS` – Disable project hook loading and invocation
(equivalent to `--no-hooks`).
- `TENZIR_TEST_DISABLE_INLINE_DEPENDENCY_INSTALL` – Disable runtime
installation for inline Python dependencies declared by tests or fixtures.
Equivalent to `--disable-inline-dependency-install`.

### Binary resolution

Expand Down
Loading