Skip to main content

Analyze test value, coverage, duplication, and generate LLM planfiles

Project description

testless

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

  • ๐Ÿค– LLM usage: $0.5874 (6 commits)
  • ๐Ÿ‘ค Human dev: ~$300 (3.0h @ $100/h, 30min dedup)

Generated on 2026-05-24 using openrouter/qwen/qwen3-coder-next


testless is a Python package that sits as an analytical layer on top of your existing test suite. It analyses test value, coverage overlap, duplication, and missing gaps, then generates LLM-ready planfile tickets that describe exactly what to remove, refactor, or add.


Features

Command What it does
testless scan Run pytest with --cov-context=test and collect metadata
testless duplicates Detect duplicate tests (coverage + AST + fixture overlap)
testless missing Suggest smoke, e2e, contract, and TestQL tests
testless planfiles Generate YAML planfile tickets for an LLM
testless doctor Answer questions: "what to remove?", "what to add?"

Quick Start

pip install testless
# or with uv:
uv add --dev testless

# 1. Scan your project
testless scan

# 2. Find duplicate tests (threshold: 85 % similarity)
testless duplicates --min-overlap 0.85

# 3. Find missing smoke / service / e2e tests
testless missing --services src/myapp

# 4. Generate LLM planfiles
testless planfiles --out .planfiles/ --with-prompts

# 5. Ask doctor questions
testless doctor "which tests should I remove?"

Configuration

Create a .testless.yml in your project root:

packages:
  - myapp

test_dirs:
  - tests

min_duplicate_score: 0.85
planfiles_dir: .planfiles
coverage_dir: .coverage_data

pytest_args:
  - --tb=short

Planfile format

Each generated ticket is a self-contained YAML file that an LLM can act on:

version: "1"
kind: duplicate
id: "DUP-3A7F2C"
title: "Remove duplicate test: test_health_ok vs test_health_status_200"
goal: "Reduce test suite redundancy without losing unique coverage"
context:
  test_a: tests/api/test_health.py::test_health_ok
  test_b: tests/api/test_health.py::test_health_status_200
evidence:
  - description: "score=0.93, coverage_overlap=0.95"
    score: 0.93
impact:
  risk: low
  expected_gains:
    - shorter test run time
    - reduced maintenance burden
tasks:
  - description: Compare test_health_ok and test_health_status_200 manually
  - description: Remove the weaker/less descriptive test
  - description: Run suite and verify no coverage regression
acceptance_criteria:
  - No decrease in unique line coverage
  - All remaining tests pass
llm_hints:
  style: minimal change
  safe_refactor: true

Architecture

src/testless/
โ”œโ”€โ”€ cli.py                  # Click CLI
โ”œโ”€โ”€ config.py               # .testless.yml loader
โ”œโ”€โ”€ models/
โ”‚   โ”œโ”€โ”€ planfile.py         # Pydantic Planfile model
โ”‚   โ”œโ”€โ”€ findings.py         # Finding models
โ”‚   โ””โ”€โ”€ coverage_map.py     # CoverageMap model
โ”œโ”€โ”€ collect/
โ”‚   โ”œโ”€โ”€ pytest_runner.py    # Run pytest, collect metadata
โ”‚   โ”œโ”€โ”€ coverage_loader.py  # Parse coverage.json contexts
โ”‚   โ”œโ”€โ”€ fixture_index.py    # AST-based fixture indexer
โ”‚   โ””โ”€โ”€ endpoint_inventory.py  # HTTP endpoint/service scanner
โ”œโ”€โ”€ analyze/
โ”‚   โ”œโ”€โ”€ duplicate_tests.py  # Duplicate detection
โ”‚   โ”œโ”€โ”€ dead_tests.py       # Dead test detection
โ”‚   โ”œโ”€โ”€ missing_tests.py    # Missing test suggestions
โ”‚   โ”œโ”€โ”€ service_risk.py     # Service risk scoring
โ”‚   โ””โ”€โ”€ refactor_candidates.py  # Refactor detection
โ”œโ”€โ”€ suggest/
โ”‚   โ”œโ”€โ”€ smoke.py            # Smoke test templates
โ”‚   โ”œโ”€โ”€ e2e.py              # E2E test templates
โ”‚   โ”œโ”€โ”€ service_tests.py    # Service contract templates
โ”‚   โ””โ”€โ”€ testql.py           # TestQL stub generator
โ”œโ”€โ”€ tickets/
โ”‚   โ”œโ”€โ”€ builder.py          # Build Planfile from findings
โ”‚   โ”œโ”€โ”€ serializer.py       # Write planfiles to disk
โ”‚   โ””โ”€โ”€ prompts.py          # Attach LLM prompts
โ””โ”€โ”€ reporters/
    โ”œโ”€โ”€ console.py          # Coloured terminal output
    โ”œโ”€โ”€ markdown.py         # Markdown report
    โ””โ”€โ”€ json.py             # JSON report

License

Licensed under Apache-2.0.

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

testless-0.1.5.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

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

testless-0.1.5-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file testless-0.1.5.tar.gz.

File metadata

  • Download URL: testless-0.1.5.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for testless-0.1.5.tar.gz
Algorithm Hash digest
SHA256 9c26c72ae0777f9bda800e84883f3825f5982df3312b64e073c9a2969932a7f0
MD5 730d2dce8feec1b138e1dd24c5cedde0
BLAKE2b-256 475edae61051a083501c55548118f3587409260a7cae78710199196a388f6ca7

See more details on using hashes here.

File details

Details for the file testless-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: testless-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for testless-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 87ac9ca3dcf8c68d8c0dbdf0723326a073d47b1cb76bbd832a2d867539101ab0
MD5 d2d296444756e7036e7066eb011e5f76
BLAKE2b-256 10b3cc8ca35eac504f8499a82442ccae97f4caff9f28ee6342776adec40f779c

See more details on using hashes here.

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