Skip to main content

Add your description here

Project description

Sandhittiko: self-evident and visible test case management tool.

Overview

Sandhittiko (sndtk) is a Python test case management tool that helps you maintain test coverage by tracking test specifications in JSON files. It analyzes your Python code, identifies functions that need test coverage, and generates test specifications that can be used to guide test implementation.

Features

  • Function Discovery: Automatically parses Python files and extracts function definitions (including nested functions and class methods)
  • Test Specification Management: Maintains test specifications in JSON files (*_spec.json) alongside your source code
  • Coverage Reporting: Reports which functions have test coverage and which scenarios are missing
  • Spec Generation: Automatically creates test specifications for uncovered functions
  • Smart Filtering: Filters out test files, gitignored files, and configurable patterns

Installation

# Using uv (recommended)
uv sync

# Or using pip
pip install -e .

Usage

Basic Usage

Scan the project and report test coverage:

sndtk --root .

Find First Uncovered Function

Find the first function that needs test coverage:

sndtk --root . --first

Create Test Specification

Create a test specification for the first uncovered function:

sndtk --root . --create --first

Target Specific Function

Analyze a specific function:

sndtk --root . --target path/to/file.py::function_name
sndtk --root . --target path/to/file.py::ClassName::method_name

Verbose Output

Get more detailed logging:

sndtk --root . -v    # INFO level
sndtk --root . -vv   # DEBUG level

Project Structure

sndtk/
├── filters/      # File filtering (gitignore, patterns, config)
├── parsers/      # Python code parsing (AST-based)
├── report/       # Test coverage reporting
└── spec/         # Test specification management

Configuration

Configure file exclusions in pyproject.toml:

[tool.sndtk]
exclude = ["*_test.py", "conftest.py"]

How It Works

  1. Parsing: Uses Python's AST to extract all function definitions from .py files
  2. Specification: Test specifications are stored in *_spec.json files containing:
    • Function identifiers
    • Test scenarios with descriptions
    • Test file paths
  3. Reporting: Compares parsed functions against specifications and checks if test functions exist
  4. Filtering: Applies multiple filters to exclude test files and other unwanted files

Test Specification Format

Test specifications are stored in JSON files (e.g., module_spec.json):

{
  "filepath": "path/to/module.py",
  "testpath": "path/to/module_test.py",
  "functions": [
    {
      "identifier": "function_name",
      "scenarios": [
        {
          "testname": "test__function_name__placeholder_scenario0",
          "description": "Placeholder scenario 0..."
        }
      ]
    }
  ]
}

Requirements

  • Python >= 3.11
  • pathspec >= 0.12.1
  • pydantic >= 2.12.4
  • tomli >= 2.0.1

Development

Install development dependencies:

uv sync --dev

Run tests:

pytest

Run type checking:

mypy sndtk
pyright sndtk

Run linting:

ruff check sndtk

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

sndtk-0.2.2.tar.gz (51.0 kB view details)

Uploaded Source

Built Distribution

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

sndtk-0.2.2-py3-none-any.whl (39.2 kB view details)

Uploaded Python 3

File details

Details for the file sndtk-0.2.2.tar.gz.

File metadata

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

File hashes

Hashes for sndtk-0.2.2.tar.gz
Algorithm Hash digest
SHA256 43b86866ba1f21ce153627839a1e20a851f6bd1b8f9bc548b8bcced8efb993c6
MD5 76a7a11dfd743a65b49888c89bb56979
BLAKE2b-256 1fb798776859964559415341b9c72f78a3c10b4f612c9d796ec8a6a9f897defd

See more details on using hashes here.

Provenance

The following attestation bundles were made for sndtk-0.2.2.tar.gz:

Publisher: publish.yml on ktnyt/sndtk

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

File details

Details for the file sndtk-0.2.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for sndtk-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2f25b3a107d94552a805752ce8d8880d99ce853bd177fe31d863c12e73ba989
MD5 7f5afebbd28849f6ef14f2c9733693bb
BLAKE2b-256 0ba8a4c26a7d07ab4a1004d5f3a7551a1f5c60152c94226255e26c268efeacfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for sndtk-0.2.2-py3-none-any.whl:

Publisher: publish.yml on ktnyt/sndtk

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