Skip to main content

autopytest

PyPI version Python versions Build Status Maintainability Codacy Badge Test Coverage

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 tests with pytest.

Features

autopytest observes file modified events and will perform the following:

  • source files
    • will find and run the associated individual test file
    • upon success, will run the entire suite
    • if we can't find a matching test, run the entire suite
  • test files
    • will run that test file
    • upon success, will 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 for applications

[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 for libraries

[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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autopytest-0.0.10.tar.gz (11.9 kB view details)

Uploaded Source

Built Distribution

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

autopytest-0.0.10-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file autopytest-0.0.10.tar.gz.

File metadata

  • Download URL: autopytest-0.0.10.tar.gz
  • Upload date:
  • Size: 11.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for autopytest-0.0.10.tar.gz
Algorithm Hash digest
SHA256 f6f66d6ac85cd8d92e4ad7e76cf89acec124ba50041b8b900acbc8e817bc75a8
MD5 d2e34db81933909ba4661e1461c9bc24
BLAKE2b-256 8e6da467b868db28830944cbfd967f0084c0d72eed3b13c6973d83a66c67c06c

See more details on using hashes here.

File details

Details for the file autopytest-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: autopytest-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.6

File hashes

Hashes for autopytest-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 b657cf224c5f48b80fd5d60457557bc3a7358c6cee3bc1a010ba4915b74c4030
MD5 7d769c413d375e502f4a4bbdbce20d17
BLAKE2b-256 5b48387af9003266186fc7bf5fe8fb74cced5e97cd69daa2eb32e5bb2ef20779

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.10 This release

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page