Skip to content

Commit

Permalink
python: update checkPhase
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Dec 18, 2024
1 parent 588e405 commit 8ec3fd5
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/grip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ buildPythonPackage rec {
];

checkPhase = ''
export PATH="$PATH:$out/bin"
runHook preCheck
py.test -xm "not assumption"
runHook postCheck
'';

meta = with lib; {
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/python-modules/limnoria/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ buildPythonPackage rec {

checkPhase = ''
runHook preCheck
export PATH="$PATH:$out/bin";
supybot-test test -v --no-network
runHook postCheck
'';
Expand Down
7 changes: 4 additions & 3 deletions pkgs/development/python-modules/manhole/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@ buildPythonPackage rec {
process-tests
];
checkPhase = ''
runHook preCheck
# Based on its tox.ini
export PYTHONUNBUFFERED=yes
export PYTHONPATH=.:tests:$PYTHONPATH
# The tests use manhole-cli
export PATH="$PATH:$out/bin"
# test_uwsgi fails with:
# http.client.RemoteDisconnected: Remote end closed connection without response
py.test -vv -k "not test_uwsgi"
runHook postCheck
'';

meta = with lib; {
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/pycflow2dot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ buildPythonPackage rec {

pythonImportsCheck = [ "pycflow2dot" ];
checkPhase = ''
runHook preCheck
cd tests
export PATH=$out/bin:$PATH
make all
runHook postCheck
'';

meta = with lib; {
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/snscrape/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ buildPythonPackage rec {

# There are no tests; make sure the executable works.
checkPhase = ''
export PATH=$PATH:$out/bin
runHook preCheck
snscrape --help
runHook postCheck
'';

pythonImportsCheck = [ "snscrape" ];
Expand Down
5 changes: 0 additions & 5 deletions pkgs/development/python-modules/stestr/tests.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,4 @@ buildPythonPackage {
'';

nativeCheckInputs = [ stestr ];

checkPhase = ''
export PATH=$out/bin:$PATH
export HOME=$TMPDIR
'';
}
5 changes: 3 additions & 2 deletions pkgs/development/python-modules/subunit2sql/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ buildPythonPackage rec {
];

checkPhase = ''
export PATH=$out/bin:$PATH
export HOME=$TMPDIR
runHook preCheck
stestr run -e <(echo "
subunit2sql.tests.db.test_api.TestDatabaseAPI.test_get_failing_test_ids_from_runs_by_key_value
Expand All @@ -48,6 +47,8 @@ buildPythonPackage rec {
subunit2sql.tests.test_shell.TestMain.test_main
subunit2sql.tests.test_shell.TestMain.test_main_with_targets
")
runHook postCheck
'';

pythonImportsCheck = [ "subunit2sql" ];
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/tempest/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,19 @@ buildPythonPackage rec {
];

checkPhase = ''
runHook preCheck
# Tests expect these applications available as such.
mkdir -p bin
export PATH="$PWD/bin:$PATH"
printf '#!${bash}/bin/bash\nexec ${python.interpreter} -m tempest.cmd.main "$@"\n' > bin/tempest
printf '#!${bash}/bin/bash\nexec ${python.interpreter} -m tempest.cmd.subunit_describe_calls "$@"\n' > bin/subunit-describe-calls
chmod +x bin/*
stestr --test-path tempest/tests run -e <(echo "
tempest.tests.lib.cli.test_execute.TestExecute.test_execute_with_prefix
")
runHook postCheck
'';

pythonImportsCheck = [ "tempest" ];
Expand Down
9 changes: 3 additions & 6 deletions pkgs/development/python-modules/twisted/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,12 @@ buildPythonPackage rec {
!(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
) optional-dependencies.tls;

preCheck = ''
export SOURCE_DATE_EPOCH=315532800
export PATH=$out/bin:$PATH
'';

checkPhase = ''
runHook preCheck
# race conditions when running in paralell
# race conditions when running in parallel
${python.interpreter} -m twisted.trial -j1 twisted
runHook postCheck
'';

Expand Down

0 comments on commit 8ec3fd5

Please sign in to comment.