parametrize-from-file 0.20.0

Creator: railscoder56

Last updated:

Add to Cart

Description:

parametrizefromfile 0.20.0

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.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.