Skip to main content

Rename test modules based on sentinel metadata and optional import-following logic

Project description

splurge-test-namer

A small tool to rename test modules based on module-level sentinel lists (e.g. DOMAINS = ['core','utils']).

package version PyPI version License: MIT

Python 3.10 Python 3.11 Python 3.12 Python 3.13 CI status coverage

ruff mypy

Usage

-- Dry run: python -m splurge_test_namer.cli --test-root tests -- Apply renames: python -m splurge_test_namer.cli --test-root tests --apply -- Follow imports under a root package: python -m splurge_test_namer.cli --test-root tests --import-root splurge_sql_tool --repo-root /path/to/repo

Force/overwrite behavior

By default the tool will not overwrite existing files. To allow overwriting targets when applying proposals, pass --force together with --apply:

python -m splurge_test_namer.cli --test-root tests --apply --force

Running tests locally

The test suite expects the package to be importable. The recommended workflow is to create and activate a virtual environment, install the package in editable mode with development dependencies, then run pytest. Example commands for common shells on Windows and Unix-like systems:

Windows (PowerShell):

python -m venv .venv
# Activate the venv in PowerShell
+& .venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -e ".[dev]"
pytest -q

Windows (Git Bash / bash or WSL):

python -m venv .venv
# Activate the venv in bash-style shells
source .venv/Scripts/activate
python -m pip install --upgrade pip
pip install -e ".[dev]"
pytest -q

macOS / Linux:

python -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -e ".[dev]"
pytest -q

Notes:

  • Use the PowerShell activation in PowerShell. Use the source .venv/Scripts/activate command in Git Bash on Windows. On macOS/Linux the activation script lives at .venv/bin/activate.
  • If you prefer not to install the package, you can run tests with PYTHONPATH=. pytest -q as a short-term workaround, though installing in editable mode is recommended.

Pre-commit hooks

We use pre-commit to run linters and checks on each commit. After installing dev dependencies, install the hooks and verify them with the commands below:

# Install pre-commit if not already installed (inside the venv)
pip install pre-commit
+
# Install hooks into your Git hooks
pre-commit install
+
# Run hooks against all files to verify configuration
pre-commit run --all-files

New in 2025.0.0

  • Import-following mode: aggregate sentinels from imported modules under a root package when proposing test filenames. -- CLI flags: --import-root, --repo-root, --verbose.

See docs/README-DETAILS.md for full API and design notes.

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

splurge_test_namer-2025.0.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

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

splurge_test_namer-2025.0.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file splurge_test_namer-2025.0.0.tar.gz.

File metadata

  • Download URL: splurge_test_namer-2025.0.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for splurge_test_namer-2025.0.0.tar.gz
Algorithm Hash digest
SHA256 8a0ab66ab647b7532409971d60a7f09a0c4fb52ec796d188e19b7ee56cc9b21b
MD5 23dd06d6508a3d581d60d1371b985a30
BLAKE2b-256 4ad1bf7c518e6009aca5e88b4165a887ff8f8299efc46a9a9fc0ddefcd987d0c

See more details on using hashes here.

File details

Details for the file splurge_test_namer-2025.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for splurge_test_namer-2025.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f47a7556977e6a8d6635570eaf2db08f94ba46bb095af4225f207442fc0e3ce1
MD5 0c13982a2fa0acee89d9a7f2e88cdca2
BLAKE2b-256 96f9873cb5994a684780a544834510dcf9e8e34b5870236fc0b2869d08747c01

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