diff --git a/src/content/docs/guides/testing/create-fixtures.mdx b/src/content/docs/guides/testing/create-fixtures.mdx index 9e331a275..6cfd60781 100644 --- a/src/content/docs/guides/testing/create-fixtures.mdx +++ b/src/content/docs/guides/testing/create-fixtures.mdx @@ -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 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 @@ -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 diff --git a/src/content/docs/reference/test-framework/index.mdx b/src/content/docs/reference/test-framework/index.mdx index fc9f2fc88..136f25ed0 100644 --- a/src/content/docs/reference/test-framework/index.mdx +++ b/src/content/docs/reference/test-framework/index.mdx @@ -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. @@ -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