Parametrize test functions with values read from config files.
Project description
Parametrize From File is a library for reading unit test parameters from config files. It works with the pytest framework. Below is the basic workflow that this package enables:
Write test cases in a JSON, YAML, TOML, or NestedText file:
# test_misc.yml test_addition: - a: 1 b: 2 c: 3 - a: 2 b: 4 c: 6
Decorate the corresponding test functions with @parametrize_from_file:
# test_misc.py import parametrize_from_file @parametrize_from_file def test_addition(a, b, c): assert a + b == c
Run pytest as usual:
$ pytest ============================= test session starts ============================== platform linux -- Python 3.8.2, pytest-6.2.4, py-1.9.0, pluggy-0.13.1 rootdir: /home/kale/hacking/projects/parametrize_from_file, configfile: pyproject.toml plugins: forked-1.1.3, anyio-3.1.0, xonsh-0.9.27, typeguard-2.12.1, cov-2.8.1, xdist-1.32.0, hypothesis-5.8.3, mock-2.0.0 collected 1 item test_misc.py .. [100%] ============================== 1 passed in 0.12s ===============================
Refer to the online documentation for more information.
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
File details
Details for the file parametrize_from_file-0.13.1.tar.gz
.
File metadata
- Download URL: parametrize_from_file-0.13.1.tar.gz
- Upload date:
- Size: 43.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a779df8cc92f834184f4ede72693fd41760b03c49b4cfe1a06f11218a3425283 |
|
MD5 | ee46d05636f895bccd85012c887d2b04 |
|
BLAKE2b-256 | f1234a6ab50b74b57eadb243dfa34da41fe7b018a3e2a6c4708af0590863b649 |
File details
Details for the file parametrize_from_file-0.13.1-py2.py3-none-any.whl
.
File metadata
- Download URL: parametrize_from_file-0.13.1-py2.py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.64.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cba49998d6f115afb40f2f3238d97dfb5f86c22f845f8d066493f77bda81255 |
|
MD5 | 05a4c3e5114e5dc9993bcdf5d0e775d7 |
|
BLAKE2b-256 | 51ec7412a4e5bbeb5765606e7d869dfdc1fdb0612cd7dfcf69c6046c2f86b027 |