pytest
No long description provided.
Installation
dagger install github.com/dagger/pytest@96505a8b0ded212d1f14c278e05aa6b75955046aEntrypoint
Return Type
Pytest !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Optional: The source directory containing your Python project |
| container | Container | - | Optional: A custom container with Python and uv installed. If not provided, defaults to Wolfi Linux with uv. |
Example
dagger -m github.com/dagger/pytest@96505a8b0ded212d1f14c278e05aa6b75955046a 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/dagger/pytest@96505a8b0ded212d1f14c278e05aa6b75955046a 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()
}container() 🔗
Optional: A custom container with Python and uv installed. If not provided, defaults to Wolfi Linux with uv.
Return Type
Container Example
dagger -m github.com/dagger/pytest@96505a8b0ded212d1f14c278e05aa6b75955046a call \
containerfunc (m *MyModule) Example() *dagger.Container {
return dag.
Pytest().
Container()
}@function
def example() -> dagger.Container:
return (
dag.pytest()
.container()
)@func()
example(): Container {
return dag
.pytest()
.container()
}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 |
|---|---|---|---|
| args | [String ! ] | - | Additional arguments to pass to pytest (e.g., ["-x", "--tb=short"]) |
| version | String | - | Python version to use (e.g., "3.12", "3.11", "3.10") |
Example
dagger -m github.com/dagger/pytest@96505a8b0ded212d1f14c278e05aa6b75955046a 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()
}