Make sure both 'python -m pytest' and 'pytest' run your tests.
Project description
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file run-all-the-tests-0.1.21.tar.gz.
File metadata
- Download URL: run-all-the-tests-0.1.21.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.0b2 CPython/3.7.9 Darwin/19.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
86ca2252aa50f7a18a41558213a001ee16ea1e98bd3aaaf7aadcd8c54481d0d1
|
|
| MD5 |
e1fd4f4c804cb03145349744901e414a
|
|
| BLAKE2b-256 |
ae5f37f4e20938dbf0a37ec6142c1442da4a277c75dd0955acee09a9dd9e5bb2
|
File details
Details for the file run_all_the_tests-0.1.21-py3-none-any.whl.
File metadata
- Download URL: run_all_the_tests-0.1.21-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.0b2 CPython/3.7.9 Darwin/19.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dcf22816e9695ab6df5a84fbff75d8d41602439be07339c44bd10b4d19184f0
|
|
| MD5 |
f280581567473289abd07e7a8148c810
|
|
| BLAKE2b-256 |
5937e1c0f819a53fb6c6c79ee068b1469c9c81abaae1e820b320dbdbee404730
|