demo showing pytest parametrize used with Django waffle
Go to file
2024-01-28 10:29:56 +00:00
app make complex more complex 2024-01-28 10:29:56 +00:00
demo initial commit 2024-01-27 18:13:22 +00:00
.gitignore initial commit 2024-01-27 18:13:22 +00:00
manage.py initial commit 2024-01-27 18:13:22 +00:00
pytest.ini initial commit 2024-01-27 18:13:22 +00:00
Readme.md initial commit 2024-01-27 18:13:22 +00:00
requirements.txt initial commit 2024-01-27 18:13:22 +00:00

pytest parametrize demo

Use parametrize with Django waffle. See blog post (TBD)

Output

(venv) timo@dev:~/blog/parametrize$ pytest
=============================================================================================== test session starts ================================================================================================
platform linux -- Python 3.9.2, pytest-7.4.4, pluggy-1.4.0
django: version: 4.2.9, settings: demo.settings (from ini)
rootdir: /home/timo/blog/parametrize
configfile: pytest.ini
plugins: django-4.7.0
collected 5 items

app/tests.py::test_complex_function[True]
-------------------------------------------------------------------------------------------------- live log call ---------------------------------------------------------------------------------------------------
INFO     app_tests:code.py:24 rewrite complex
PASSED                                                                                                                                                                                                       [ 20%]
app/tests.py::test_complex_function[False]
-------------------------------------------------------------------------------------------------- live log call ---------------------------------------------------------------------------------------------------
INFO     app_tests:code.py:29 deprecated complex
PASSED                                                                                                                                                                                                       [ 40%]
app/tests.py::test_simple[foo bar] PASSED                                                                                                                                                                    [ 60%]
app/tests.py::test_simple[baz zab] PASSED                                                                                                                                                                    [ 80%]
app/tests.py::test_simple[1 2 3 4 5] PASSED                                                                                                                                                                  [100%]

================================================================================================ 5 passed in 0.21s =================================================================================================