doc: python: Run hooks in checkPhase
This commit is contained in:
parent
2628f0003c
commit
83481b8708
1 changed files with 15 additions and 1 deletions
|
@ -570,7 +570,13 @@ test run would be:
|
||||||
|
|
||||||
```
|
```
|
||||||
checkInputs = [ pytest ];
|
checkInputs = [ pytest ];
|
||||||
checkPhase = "pytest";
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
|
|
||||||
|
pytest
|
||||||
|
|
||||||
|
runHook postCheck
|
||||||
|
'';
|
||||||
```
|
```
|
||||||
|
|
||||||
However, many repositories' test suites do not translate well to nix's build
|
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 ];
|
checkInputs = [ pytest ];
|
||||||
# avoid tests which need additional data or touch network
|
# avoid tests which need additional data or touch network
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
|
|
||||||
pytest tests/ --ignore=tests/integration -k 'not download and not update'
|
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
|
# assumes the tests are located in tests
|
||||||
checkInputs = [ pytest ];
|
checkInputs = [ pytest ];
|
||||||
checkPhase = ''
|
checkPhase = ''
|
||||||
|
runHook preCheck
|
||||||
|
|
||||||
py.test -k 'not function_name and not other_function' tests
|
py.test -k 'not function_name and not other_function' tests
|
||||||
|
|
||||||
|
runHook postCheck
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in a new issue