Autotest python code
Project description
An implementation of autotest
for Python inspired by autotest and guard.
autopytest observes file change events and whenever you save a file it runs the appropriate test, upon success it runs your entire test suite and if we can't find a matching test file for a given source, we also run the entire suite.
Install
# pip
pip install autopytest
# poetry
poetry add autopytest
Configuration
In your pyproject.toml
add the following.
[tool.autopytest]
source_directories = ["app"]
test_directory = "tests"
Usage
cd {project}
autopytest
autopytest {path}
Project Structure
- Test naming is currently important.
- Multiple nested directory structures are supported as long as the convention is followed.
Applications
pyproject.toml
[tool.autopytest]
source_directories = ["app", "lib"]
test_directory = "tests"
Given the above configuration. You should use a directory structure like the following. e.g. If app/package/module.py
is edited we will attempt to locate and run tests/app/package/test_module.py
📁 app
📄 __init__.py
📁 package
📄 __init__.py
📄 module.py
📁 lib
📁 tests
📄 __init__.py
📁 app
📁 package
📄 test_module.py
📁 lib
Libraries
pyproject.toml
[tool.autopytest]
include_source_dir_in_test_path = False
source_directories = ["src"]
test_directory = "tests"
If you are developing library and want your folder structure like the following. e.g. If src/package/module.py
is edited we will attempt to locate and run tests/package/test_module.py
📁 src
📁 package
📄 __init__.py
📄 module.py
📁 tests
📁 package
📄 test_module.py
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for autopytest-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a88b71148c24b4d09deaa42d0a871638c6bafb4e95c8722d2b6ec302980d0813 |
|
MD5 | 3a81082c46a498d2a29e7f5ae776c1ae |
|
BLAKE2b-256 | b30fd8215dae46e8a31afeb9b9309957a752b42fb81e58580c92f0604b303092 |