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.19.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14f4ceda16194fb6ec4323cd72304493c4992a9e75a3f78c579fd4e7c5b948f2 |
|
MD5 | 74f9af727bff5abed718a94395e7eaf8 |
|
BLAKE2b-256 | 34fd57693379f7f2100c1c58cb56393682014a7ce09cce5e766d472612e58cf9 |
Close
Hashes for parametrize_from_file-0.19.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 855a3cefb693b2422ce61a3e845511aaddec5c74011ab979de6e63d75ed3e992 |
|
MD5 | 34012a62492f6ca48403d151077454cc |
|
BLAKE2b-256 | 7b8f03f0a096eddc15fb9db23a24f9172648eac9ec34ba1021b871ac48727076 |