pytest
A toolchain for testing Python applications with automatic OpenTelemetry tracing
Installation
dagger install github.com/dagger/pytest@cc6d7e8ecdcc958bd229f3865b222ed2635ca64aEntrypoint
Return Type
Pytest ! Example
dagger -m github.com/dagger/pytest@cc6d7e8ecdcc958bd229f3865b222ed2635ca64a 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 🔗
test() 🔗
Test a Python project with pytest and OpenTelemetry tracing.
This function automatically injects pytest_otel for test tracing visibility in Dagger TUI and Dagger Cloud. No configuration required.
The function will: - Use the provided container or default to Wolfi Linux with uv - Install your project dependencies using uv sync - Inject pytest_otel for automatic test tracing - Run pytest with the specified Python version
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | No description provided |
| container | Container | - | No description provided |
| args | [String ! ] | - | No description provided |
| version | String | - | No description provided |
Example
dagger -m github.com/dagger/pytest@cc6d7e8ecdcc958bd229f3865b222ed2635ca64a 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()
}