From 83481b87082efe630b6bcd3c5089f488d90be51f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Tue, 3 Jan 2023 14:28:23 +0100 Subject: [PATCH] doc: python: Run hooks in checkPhase --- doc/languages-frameworks/python.section.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index ab5ba4289585..2f15d0f0468a 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -570,7 +570,13 @@ test run would be: ``` checkInputs = [ pytest ]; - checkPhase = "pytest"; + checkPhase = '' + runHook preCheck + + pytest + + runHook postCheck + ''; ``` However, many repositories' test suites do not translate well to nix's build @@ -582,7 +588,11 @@ To filter tests using pytest, one can do the following: checkInputs = [ pytest ]; # avoid tests which need additional data or touch network checkPhase = '' + runHook preCheck + pytest tests/ --ignore=tests/integration -k 'not download and not update' + + runHook postCheck ''; ``` @@ -1408,7 +1418,11 @@ example of such a situation is when `py.test` is used. # assumes the tests are located in tests checkInputs = [ pytest ]; checkPhase = '' + runHook preCheck + py.test -k 'not function_name and not other_function' tests + + runHook postCheck ''; } ```