🗺️ autotestmap
Instantly discover the connections between your source code and your tests.
autotestmap is a fast, zero-dependency developer utility that scans your Python project and builds a map of which test files are exercising your source code. It helps you quickly find relevant tests, identify potentially untested code, and understand your project's test coverage structure at a glance.
❓ Why use autotestmap?
In any growing Python project, it can be challenging to answer questions like:
- “If I change this file, which tests do I need to run?”
- “Where are the tests for this specific module?”
- “Does this source file even have any tests?”
autotestmap answers these questions by analyzing your codebase and providing a clear, intuitive map of the relationships.
✨ Key Features
- ✅ Automatic Directory Detection: Intelligently finds common
srcandtestsdirectories when run with no arguments. - 🧠 Smart Mapping: Uses two powerful strategies:
- Direct Naming Conventions (e.g.,
user.py→test_user.py) - Static Import Analysis (detects tests that import the source module)
- Direct Naming Conventions (e.g.,
- 🚀 Flexible Usage Modes: Run it against your whole project or focus on a single file.
- ✨ Clean CLI: Beautiful emoji-coded output.
- 🤖 JSON Output: Use
--jsonfor machine-readable results, ideal for CI/CD. - 🕊️ Zero-Dependency: No external libraries needed.
📦 Installation
Install directly from PyPI:
pip install autotestmap
🚀 How to Use
Autotestmap can be run in three different modes depending on your needs.
🔹 Mode 1: Automatic Discovery (No Arguments), Scans for common source (e.g., src, app) and test (tests) folders in your current directory.
🔍 Mode: Auto-discovery
✅ auth.py
🔗 Direct → test_auth.py
✅ models.py
🔎 Indirect → test_user_logic.py
⚠️ payment.py → No tests found
🔹 Mode 2: Specific File Mapping (One Argument), Find all tests related to a single source file:
🔍 Mode: Single file mapping
✅ models.py
🔎 Indirect → test_user_logic.py
🔹 Mode 3: Directory Specification (Two Arguments), Use this if your project has custom directory names:
autotestmap my_app/ specifications/
🧾 Output Legend
✅ [file] – A source file that has at least one associated test.
🔗 Direct – Test file matches by naming convention (strong link).
🔎 Indirect – Test file imports the source file (weaker link).
⚠️ [file] – No matching test found (requires -v flag in directory mode).
🔧 Advanced Usage
🧪 JSON Output
Use the --json flag to get machine-readable output (works in all modes):
{
"auth.py": {
"direct": ["test_auth.py"],
"indirect": []
},
"models.py": {
"direct": [],
"indirect": ["test_user_logic.py"]
},
"payment.py": {
"direct": [],
"indirect": []
}
}
📣 Verbose Mode
To include all source files, even if no tests were found:
autotestmap -v
🤝 Contributing
Contributions are welcome! Whether it's a bug report, feature request, or a pull request — all contributions help make autotestmap better.
Please feel free to open an issue or submit a PR on GitHub.
📄 License This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for autotestmap 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autotestmap-1.0.0.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autotestmap-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / autotestmap-1.0.0.tar.gz
| Download URL | autotestmap-1.0.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b201f8e28cd34e1a932a11f90ffcbe3fa2e6734c66d0d073e25b7db94929cc5
|
|
BLAKE2b-256 checksum How to use checksums |
a5dd55ab54ee30365bd9a929868aa67744484eb6e34e5f9355bd840359312fdc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|
Release files / autotestmap-1.0.0-py3-none-any.whl
| Download URL | autotestmap-1.0.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a96108945126e19e2cff509f516bc78d58bb97f7ee2c4f96587e47cb7a5a73e
|
|
BLAKE2b-256 checksum How to use checksums |
0444bc13bcfac38be628c29fb36b3b5ca4e540152108d5d1e36d82f635161818
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.9
|