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
Close
Hashes for parametrize_from_file-0.9.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb2058e25f04acc29f9a5e080dc5518846e8045cbc4376d3cf825015949e57ff |
|
MD5 | 021ca6893e2b0e6aaec9998aa8138294 |
|
BLAKE2b-256 | 04055d9fcd8ed3854d7f0f786ba207abcfbd80492c54507b39472053c00a1dff |
Close
Hashes for parametrize_from_file-0.9.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64b2419c4a5e995724a1fbf3590c92dce9b3a781d2c9de3b7331f9bbb6f5347b |
|
MD5 | bc44686a471d5a29eab1c4a97245d7b7 |
|
BLAKE2b-256 | 6b1af0bfd41edf01d2a11af7768a6b82e7ae5f52fc18ccff6d3d6b4b27e52bc3 |