From 35bedb22c82d16f7bda11096bc553d510dcbd40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Thu, 10 Jul 2025 12:36:23 +0000 Subject: [PATCH] Update pytest how to for BIND system tests: add hypothesis command line switches --- pytest-howto.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pytest-howto.md b/pytest-howto.md index aed7298..2d899c7 100644 --- a/pytest-howto.md +++ b/pytest-howto.md @@ -3,6 +3,7 @@ title: pytest how-to for BIND system tests --- + See [[/bin/tests/system/README|/../blob/main/bin/tests/system/README.md]] first # Debugging @@ -15,4 +16,8 @@ See [[/bin/tests/system/README|/../blob/main/bin/tests/system/README.md]] first Pytest has framework for providing 'context' to tests in a consistent manner. Their term for it is 'fixture' and it manifests itself as a function parameter with name which is nowhere to be found. See https://docs.pytest.org/en/7.1.x/explanation/fixtures.html # Runtime data -As a very first step, Pytest "collects" tests: Effectively it imports all Python files without executing test functions and does filtering (e.g. for `-k` command line parameter), and it executes `setup.sh` and other code only for tests which were selected/passed all conditions. For this reason you cannot access any files/data generated by `setup.sh` from _outside_ of test function body. This limitation applies also to arguments of @decorators around test functions. \ No newline at end of file +As a very first step, Pytest "collects" tests: Effectively it imports all Python files without executing test functions and does filtering (e.g. for `-k` command line parameter), and it executes `setup.sh` and other code only for tests which were selected/passed all conditions. For this reason you cannot access any files/data generated by `setup.sh` from _outside_ of test function body. This limitation applies also to arguments of @decorators around test functions. + +# Hypothesis library +- `--hypothesis-show-statistics` to see how many examples the library generated and how many got actually executed +- `--hypothesis-seed=0` to get de-randomized behavior for debugging \ No newline at end of file