Skip to main content

A testing harness for Python packages using uv's isolated environments

Project description

testudos

A testing harness for Python packages using uv's isolated environments.

Overview

Testudos simplifies running your Python package's test suite across multiple Python versions. It automatically determines which versions to test based on:

  1. Currently supported Python versions - Fetched from endoflife.date
  2. Your package's compatibility - Parsed from requires-python in pyproject.toml

Only versions that are both still supported by Python and compatible with your package are tested.

Quick Start

# Install testudos
uv tool install testudos

# Run tests on all compatible Python versions
testudos run

# Run tests in parallel for speed
testudos run --parallel

# See which versions would be tested
testudos versions

# Preview commands without running (dry-run)
testudos run --dry-run

Installation

# Using uv (recommended)
uv tool install testudos

# Using pip
pip install testudos

Requirements

  • Python 3.11+
  • uv - Fast Python package installer

Usage

Running Tests

# Run tests on all compatible versions (sequential)
testudos run

# Run tests in parallel
testudos run --parallel
testudos run -P

# Limit parallel jobs
testudos run --parallel --jobs 4
testudos run -P -j 4

# Test specific Python versions
testudos run --python 3.11 --python 3.12
testudos run -p 3.11 -p 3.12

# Fail fast (stop on first failure) - default in sequential mode
testudos run --fail-fast
testudos run -f

# Continue on failures
testudos run --no-fail-fast
testudos run -F

# Verbose output
testudos run --verbose
testudos run -v

# Dry run - show what would be executed
testudos run --dry-run
testudos run -n

# Test a specific project directory
testudos run ./path/to/project

Test Coverage

Testudos can collect and aggregate test coverage data across all Python versions:

# Run tests with coverage collection
testudos run --coverage

# Run with coverage and generate HTML report
testudos run --coverage --coverage-report html

# Run with coverage threshold (fail if below 80%)
testudos run --coverage --coverage-fail-under 80

# Multiple report formats
testudos run --coverage --coverage-report html --coverage-report xml

# Available report formats: term, term-missing, html, xml, json, lcov

Coverage Commands

Manage coverage data manually:

# Combine coverage from multiple Python versions
testudos coverage combine

# Generate coverage report
testudos coverage report
testudos coverage report --format html

# Clean coverage data
testudos coverage clean

Installing Coverage Support

Coverage collection requires the coverage package:

# Install testudos with coverage support
pip install testudos[coverage]

# Or add coverage to your project dependencies
uv add coverage

Viewing Versions

# Show versions that would be tested
testudos versions

# Show versions for a specific project
testudos versions ./path/to/project

Configuration

Configure testudos in your pyproject.toml:

[project]
requires-python = ">=3.11"

[tool.testudos]
# Optional: Override auto-detected Python versions
python-versions = ["3.11", "3.12", "3.13"]

# Test command to run (default: "pytest")
test-command = "pytest"

# Additional arguments for test command
test-args = ["-v", "--tb=short"]

# Run tests in parallel by default
parallel = false

# Maximum parallel jobs (default: number of versions)
max-jobs = 4

# Coverage options
coverage = true                     # Enable coverage collection
coverage-combine = true             # Combine coverage from all versions
coverage-report = ["html", "xml"]   # Report formats to generate
coverage-fail-under = 80            # Fail if coverage below threshold

Configuration Validation

Testudos validates your configuration on load and will:

  • Error on invalid types or values
  • Warn on unknown configuration keys

How It Works

Testudos uses uv run --isolated to create ephemeral, isolated environments for each Python version. This ensures:

  1. Clean test environments - No leftover state between versions
  2. Fast execution - uv's caching makes environment creation nearly instant
  3. No version conflicts - Each version is completely isolated

Example Command

For Python 3.11, testudos runs:

uv run --isolated --python=3.11 pytest

Features

  • Automatic version detection: Fetches supported versions from endoflife.date API
  • Smart caching: 24-hour TTL cache for API responses with offline fallback
  • Parallel execution: Run tests concurrently with live progress display
  • Coverage aggregation: Collect and combine coverage data across all Python versions
  • Dry-run mode: Preview commands without execution
  • Configuration validation: Schema validation for [tool.testudos] settings
  • Input validation: Safe command construction with validation

Documentation

Development

# Clone the repository
git clone https://github.com/martinristovski/testudos.git
cd testudos

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run testudos on itself
uv run testudos run

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

testudos-0.10.0.tar.gz (100.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

testudos-0.10.0-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

Details for the file testudos-0.10.0.tar.gz.

File metadata

  • Download URL: testudos-0.10.0.tar.gz
  • Upload date:
  • Size: 100.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for testudos-0.10.0.tar.gz
Algorithm Hash digest
SHA256 3407b7075ec578a37c002e69619e0241e32a64e70448ab5e1d7d82ecf2ae4ad3
MD5 47736aec99893235eb8231a94af82041
BLAKE2b-256 8deb52071851acbd1d13f45375661fc3fcef88f956bf2ec32a69937cddfe6019

See more details on using hashes here.

Provenance

The following attestation bundles were made for testudos-0.10.0.tar.gz:

Publisher: python-publish.yml on martinristovski/testudos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file testudos-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: testudos-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for testudos-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adb14f5de0ad4a1fc97ae40a15b91e25d468d947f265c4329dc711d0723e89e9
MD5 01bbb431eb5f47a7fb872f4f1e598c10
BLAKE2b-256 1b39b058f9a9fe2360c67a422a97e84a5178a41d43e529f1b1018d5d425110fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for testudos-0.10.0-py3-none-any.whl:

Publisher: python-publish.yml on martinristovski/testudos

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page