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
Close
Hashes for parametrize_from_file-0.20.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7858b343902fc4ac19ce18ae85a1821f8e82ffcc5f4cc4f4e126d18cd6750be |
|
MD5 | b91b125d7bc895b42cb3a57c40c1f9c2 |
|
BLAKE2b-256 | 6447ea83f2dc62293adef669ba5fafe8472b1077fb72e1af548c2b8812da7c16 |
Close
Hashes for parametrize_from_file-0.20.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a4575305cb19e8a94d6fc803b40d59ed633601ce3bc9e50ba266342a97907bb |
|
MD5 | 43ac22a9b55ee9cc0e0557fcf12b5086 |
|
BLAKE2b-256 | 4c33fcb788c78a6dc676c39e669fe166b5901ad9aa5eb7915dee0228f9e10a7d |