pytest
No long description provided.
Installation
dagger install github.com/eunomie/pytest@37ff5ca0304e7306f8432dd14d4d0156809d02eaEntrypoint
Return Type
Pytest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Optional: The source directory containing your Python project |
| pythonVersion | String | - | Optional: Python version to use (e.g., "3.14", "3.13", "3.12") Only relevant if you are not setting a specific custom container. |
Example
dagger -m github.com/eunomie/pytest@37ff5ca0304e7306f8432dd14d4d0156809d02ea call \
func (m *MyModule) Example() *dagger.Pytest {
return dag.
Pytest()
}@function
def example() -> dagger.Pytest:
return (
dag.pytest()
)@func()
example(): Pytest {
return dag
.pytest()
}Types
Pytest 🔗
source() 🔗
Optional: The source directory containing your Python project
Return Type
Directory ! Example
dagger -m github.com/eunomie/pytest@37ff5ca0304e7306f8432dd14d4d0156809d02ea call \
sourcefunc (m *MyModule) Example() *dagger.Directory {
return dag.
Pytest().
Source()
}@function
def example() -> dagger.Directory:
return (
dag.pytest()
.source()
)@func()
example(): Directory {
return dag
.pytest()
.source()
}pythonVersion() 🔗
Optional: Python version to use (e.g., “3.14”, “3.13”, “3.12”)
Only relevant if you are not setting a specific custom container.
Return Type
String ! Example
dagger -m github.com/eunomie/pytest@37ff5ca0304e7306f8432dd14d4d0156809d02ea call \
python-versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Pytest().
PythonVersion(ctx)
}@function
async def example() -> str:
return await (
dag.pytest()
.python_version()
)@func()
async example(): Promise<string> {
return dag
.pytest()
.pythonVersion()
}test() 🔗
Test a Python project with pytest and OpenTelemetry tracing.
Runs against the toolchain’s own base (Alpine Linux with uv) with pytest_otel pre-installed, so test spans show up in the Dagger TUI and Dagger Cloud with no configuration.
To trace pytest inside your own container/setup instead, use installPytestOtel and run pytest yourself.
The function will:
- Provision the base with Python for the requested version
- Install your project dependencies (via uv run for pyproject, or requirements.txt)
- Run pytest with pytest_otel enabled
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| args | [String ! ] | - | Additional arguments to pass to pytest (e.g., ["-x", "--tb=short"]) |
Example
dagger -m github.com/eunomie/pytest@37ff5ca0304e7306f8432dd14d4d0156809d02ea call \
testfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Pytest().
Test(ctx)
}@function
async def example() -> None:
return await (
dag.pytest()
.test()
)@func()
async example(): Promise<void> {
return dag
.pytest()
.test()
}installPytestOtel() 🔗
Install pytest_otel into a container you manage yourself.
Use this when you bring your own container (Python, dependencies and a
working environment already set up) and just want pytest_otel injected, so
your own pytest run is traced in the Dagger TUI and Dagger Cloud. The bundled
pytest_otel is installed with whatever Python tooling the container provides:
uv if available, otherwise pip (directly or via python -m pip).
Returns the container with pytest_otel installed; run pytest yourself on it.
Return Type
Container !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| ctr | Container ! | - | No description provided |
Example
dagger -m github.com/eunomie/pytest@37ff5ca0304e7306f8432dd14d4d0156809d02ea call \
install-pytest-otel --ctr IMAGE:TAGfunc (m *MyModule) Example(ctr *dagger.Container) *dagger.Container {
return dag.
Pytest().
InstallPytestOtel(ctr)
}@function
def example(ctr: dagger.Container) -> dagger.Container:
return (
dag.pytest()
.install_pytest_otel(ctr)
)@func()
example(ctr: Container): Container {
return dag
.pytest()
.installPytestOtel(ctr)
}