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_camelot.yml test_str_find: - str: sir lancelot sub: lance loc: 4 - str: sir robin sub: brave loc: -1
Decorate the corresponding test functions with @parametrize_from_file:
# test_camelot.py import parametrize_from_file @parametrize_from_file def test_str_find(str, sub, loc): assert str.find(sub) == loc
Run pytest as usual:
============================= test session starts ============================== platform linux -- Python 3.10.0, pytest-7.4.0, pluggy-1.2.0 rootdir: /home/arthur/holy_grail collected 2 items test_camelot.py .. [100%] ============================== 2 passed in 0.09s ===============================
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.18.0.tar.gz
.
File metadata
- Download URL: parametrize_from_file-0.18.0.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 99813c27b5d696f092d87de4b746c1f1dc8f1c50ea996f0d887f540ab35c7005 |
|
MD5 | 8849b11df130b2ef8392453a194dbae9 |
|
BLAKE2b-256 | 83303e749b8320434dd0eb7c03ff3a3e36f85c50e80ba2aa68fd0648b4f1ed27 |
File details
Details for the file parametrize_from_file-0.18.0-py3-none-any.whl
.
File metadata
- Download URL: parametrize_from_file-0.18.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a16df2e3e4af954c33f31d3cb5c24636585170fa494a1b4d8b35dc610d01c1cd |
|
MD5 | ced77d6c7dd7551cd112ddf9886b376e |
|
BLAKE2b-256 | f387ea17a8bad4e1e49a13ed36518c42f0220c1881c80040493055d83382ada6 |