Skip to main content

Run a series of test invocation making sure each test case works with both 'pytest' and 'python -m pytest' over all working directories between the project root and the directory containing the test script.

├─ src
│
│<-- # run selected __main__'s from this working directory
│
│  └─ __init__.py
│  └─ foo.py
│  ├─ bar
│  │   └─ __init__.py
│  │   └─ bar.py
│  │
│  │<-- # run selected __main__'s from this working directory
│  │
│  └─ run_foo_main.py
│  └─ run_bar_main.py
│
│<-- # run selected test cases from this working directory
│
├─ tests
│  │
│  │<-- # run selected test cases from this working directory
│  │
│  └─ test_foo.py
│  └─ bar
│        │<-- # run selected bar test cases from this working directory
│        │
│        └─ test_bar.py
└─ setup.py

Your run_all_my_tests.py:

from run_all_the_tests import TestCasePath, TestCase, Group, TestType

if __name__ == '__main__': 
    project_path: PurePath = Path(__file__).absolute().parent.parent


    def gen_test_case_path(test_case: str) -> TestCasePath:
        return TestCasePath(project_path, PurePath(test_case))


    all_test_cases: Tuple[TestCase, ...] = (
        TestCase.gen_test_case(gen_test_case_path('tests/test_foo.py')),
        TestCase.gen_test_case(gen_test_case_path('tests/bar/test_bar.py')),
    )

    run_all_tests(all_test_cases)

Each set of tests are run in parallel within Group.ONE. Designate tests to run within non-conflicting groups of parallel runs by assigning all test cases that can run without conflict to the same Group.

    all_test_cases: Tuple[TestCase, ...] = (
        TestCase.gen_test_case(gen_test_case_path('tests/test_foo.py')),
        TestCase.gen_test_case(gen_test_case_path('tests/bar/test_bar.py'), Group.TWO),
    )

TestCase.gen_test_case() also supports the following agrs:

    pytest_filter: str = None
    :param pytest_filter: pytest -k string
 
    test_types: Tuple[TestType, ...] = TestType.all_test_types()
    :param test_types: for exceptional situations, limit a TestCase to run for limited set of TestType's

Release files for run-all-the-tests 0.1.21

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for run-all-the-tests 0.1.21
File Size Uploaded
run-all-the-tests-0.1.21.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for run-all-the-tests 0.1.21
File Interpreter ABI Platform
run_all_the_tests-0.1.21-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / run-all-the-tests-0.1.21.tar.gz

Download URL run-all-the-tests-0.1.21.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
86ca2252aa50f7a18a41558213a001ee16ea1e98bd3aaaf7aadcd8c54481d0d1
BLAKE2b-256 checksum
How to use checksums
ae5f37f4e20938dbf0a37ec6142c1442da4a277c75dd0955acee09a9dd9e5bb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.0b2 CPython/3.7.9 Darwin/19.6.0

Release files / run_all_the_tests-0.1.21-py3-none-any.whl

Download URL run_all_the_tests-0.1.21-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5dcf22816e9695ab6df5a84fbff75d8d41602439be07339c44bd10b4d19184f0
BLAKE2b-256 checksum
How to use checksums
5937e1c0f819a53fb6c6c79ee068b1469c9c81abaae1e820b320dbdbee404730
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.0b2 CPython/3.7.9 Darwin/19.6.0

Release history Release notifications | RSS feed

This release

0.1.21 This release

2 release files

0.1.17

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release 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