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 0000fbe commit e0393d9
Show file tree
Hide file tree
Showing 18 changed files with 37 additions and 26 deletions.
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/async-dns/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,13 @@ buildPythonPackage rec {
nativeBuildInputs = [ poetry-core ];

checkPhase = ''
export HOME=$TMPDIR
runHook preCheck
# Test needs network access
rm -r tests/resolver
${python.interpreter} -m unittest
runHook postCheck
'';

pythonImportsCheck = [ "async_dns" ];
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/basemap/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,12 @@ buildPythonPackage rec {
doCheck = false;

checkPhase = ''
runHook preCheck
cd ../../examples
export HOME=$TEMPDIR
${python.interpreter} run_all.py
runHook postCheck
'';

meta = with lib; {
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/python-modules/biopython/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ buildPythonPackage rec {
checkPhase = ''
runHook preCheck
export HOME=$(mktemp -d)
cd Tests
python run_tests.py --offline
Expand Down
2 changes: 0 additions & 2 deletions pkgs/development/python-modules/brian2/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ buildPythonPackage rec {

checkPhase = ''
runHook preCheck
# Cython cache lies in home directory
export HOME=$(mktemp -d)
cd $HOME && ${python.interpreter} -c "import brian2;assert brian2.test()"
runHook postCheck
'';
Expand Down
1 change: 0 additions & 1 deletion pkgs/development/python-modules/commonmark/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ buildPythonPackage rec {
${python.interpreter} commonmark/tests/run_spec_tests.py
${python.interpreter} commonmark/tests/unit_tests.py
export PATH=$out/bin:$PATH
cmark commonmark/tests/test.md
cmark commonmark/tests/test.md -a
cmark commonmark/tests/test.md -aj
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ buildPythonPackage rec {

checkPhase = ''
runHook preCheck
export PATH=${pkgs.openldap}/bin:${pkgs.openldap}/libexec:$PATH
export PATH=${pkgs.openldap}/libexec:$PATH
${python.interpreter} -m django test --settings tests.settings
runHook postCheck
'';
Expand Down
6 changes: 5 additions & 1 deletion pkgs/development/python-modules/finalfusion/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ buildPythonPackage rec {
'';

checkPhase = ''
runHook preCheck
# Regular unit tests.
pytest
# Integration tests for command-line utilities.
PATH=$PATH:$out/bin tests/integration/all.sh
tests/integration/all.sh
runHook postCheck
'';

meta = with lib; {
Expand Down
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
1 change: 0 additions & 1 deletion pkgs/development/python-modules/localstack/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ buildPythonPackage rec {
checkPhase = ''
runHook preCheck
export HOME=$(mktemp -d)
$out/bin/localstack --version
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
1 change: 0 additions & 1 deletion pkgs/development/python-modules/outlines/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ buildPythonPackage rec {
];

checkPhase = ''
export HOME=$(mktemp -d)
python3 -c 'import outlines'
'';

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
1 change: 0 additions & 1 deletion pkgs/development/python-modules/reno/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ buildPythonApplication rec {

checkPhase = ''
runHook preCheck
export HOME=$(mktemp -d)
stestr run -e <(echo "
# Expects to be run from a git repository
reno.tests.test_cache.TestCache.test_build_cache_db
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

0 comments on commit e0393d9

Please sign in to comment.