Skip to main content

Sensoria: High-fidelity coverage impact analysis for Python.

Project description

Stellar Engineering Command Banner

PyPI Build Status Python Versions License

PyPI Build Status Python Versions License

Captain's Log: ML-powered Sensor Telemetry Analysis module for pytest that identifies high-impact, low-complexity areas to test first.

Scanning the planetary surface (codebase) to determine sensor coverage (test coverage) and identify critical impact zones for the fleet.

Features

  • Coverage Impact Analysis: Builds call graphs to identify high-impact functions
  • ML Complexity Estimation: Predicts test complexity with confidence intervals
  • Prioritization: Suggests what to test first based on impact and complexity
  • Refitted Out of the Box: Includes pre-trained model, no console calibration required
  • Warp Speed Performance: Optimized for speed (analyzes 1700+ functions in ~1.5 seconds)
  • Real-time Telemetry: Visual progress bars and step-by-step timing

Docking Procedures

pip install pytest-coverage-impact

Flight Manual

# Run sensor telemetry analysis (--cov-report=json automatically added)
pytest --cov=your_project --coverage-impact

# Show top 10 functions by priority
pytest --cov=your_project --coverage-impact --coverage-impact-top=10

# Generate Telemetry Data (JSON report)
pytest --cov=your_project --coverage-impact --coverage-impact-json=report.json

Example Telemetry Output

Top Functions by Priority (Impact / Complexity)
┏━━━━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━━━━━┓
┃ Priority ┃ Score ┃ Impact ┃ Complexity ┃ Function   ┃
┡━━━━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━━━━━━╇━━━━━━━━━━━━┩
│        1 │  2.45 │   12.5 │  0.65 [±0.15] │ module.py │

How It Works

  1. Call Graph Analysis: Parses AST to build function call relationships
  2. Impact Calculation: impact = call_frequency × (1 - coverage_pct)
  3. Complexity Estimation: Uses Random Forest ML model (0-1 scale)
  4. Prioritization: priority = (impact × confidence) / (complexity × effort)
  5. Reporting: Generates formatted sensor reports showing what to test first

Model Training (Optional)

Module includes pre-trained model - no training required. To recalibrate:

# Combined command - collects telemetry and recalibrates model
pytest --coverage-impact-train

See docs/TRAINING_COMMANDS.md for details.

Requirements

  • Python 3.8+
  • pytest 7.0+
  • coverage 6.0+
  • scikit-learn 1.0+
  • numpy 1.20+
  • rich 13.0+ (terminal formatting)

Mission Log

Documentation

Development

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest tests/

# Format code
black pytest_coverage_impact tests/
ruff check pytest_coverage_impact tests/

License

MIT License

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

pytest_coverage_impact-1.2.3.tar.gz (249.3 kB view details)

Uploaded Source

Built Distribution

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

pytest_coverage_impact-1.2.3-py3-none-any.whl (251.8 kB view details)

Uploaded Python 3

File details

Details for the file pytest_coverage_impact-1.2.3.tar.gz.

File metadata

  • Download URL: pytest_coverage_impact-1.2.3.tar.gz
  • Upload date:
  • Size: 249.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for pytest_coverage_impact-1.2.3.tar.gz
Algorithm Hash digest
SHA256 f87c11a5b87874a645da49f211815ecd37b0bbcd6a19a8b1aa7c6c2788af5670
MD5 d36f86f3b570ed9429c358616e336308
BLAKE2b-256 fa225e9e82aa5e702f4be2f85a29883cc26fbfdf8be03b383bbd4ba952646ada

See more details on using hashes here.

File details

Details for the file pytest_coverage_impact-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_coverage_impact-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bc43ba1777a07777f4be94a989c2bf967ffb0c446bb9a2b355d58d558b6234dd
MD5 cbca33513b64a87d57d56ed08625ecaf
BLAKE2b-256 4520187a28b1d9b7f1a7a401520f398132560a10db84ee7f3e1b8fb71a86c5e4

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