From e0393d95914318ce05b4e8d5d31c67c009a80b08 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Wed, 18 Dec 2024 12:39:30 +0100 Subject: [PATCH] python: update `checkPhase` --- pkgs/development/python-modules/async-dns/default.nix | 5 ++++- pkgs/development/python-modules/basemap/default.nix | 5 ++++- pkgs/development/python-modules/biopython/default.nix | 1 - pkgs/development/python-modules/brian2/default.nix | 2 -- pkgs/development/python-modules/commonmark/default.nix | 1 - .../python-modules/django-auth-ldap/default.nix | 2 +- pkgs/development/python-modules/finalfusion/default.nix | 6 +++++- pkgs/development/python-modules/grip/default.nix | 5 ++++- pkgs/development/python-modules/limnoria/default.nix | 1 - pkgs/development/python-modules/localstack/default.nix | 1 - pkgs/development/python-modules/manhole/default.nix | 7 ++++--- pkgs/development/python-modules/outlines/default.nix | 1 - pkgs/development/python-modules/pycflow2dot/default.nix | 5 ++++- pkgs/development/python-modules/reno/default.nix | 1 - pkgs/development/python-modules/snscrape/default.nix | 5 ++++- pkgs/development/python-modules/stestr/tests.nix | 5 ----- pkgs/development/python-modules/subunit2sql/default.nix | 5 +++-- pkgs/development/python-modules/tempest/default.nix | 5 ++++- 18 files changed, 37 insertions(+), 26 deletions(-) diff --git a/pkgs/development/python-modules/async-dns/default.nix b/pkgs/development/python-modules/async-dns/default.nix index cbc8f15ed2107c..32f6ecbe3c187a 100644 --- a/pkgs/development/python-modules/async-dns/default.nix +++ b/pkgs/development/python-modules/async-dns/default.nix @@ -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" ]; diff --git a/pkgs/development/python-modules/basemap/default.nix b/pkgs/development/python-modules/basemap/default.nix index 7e435d08fa3151..07c44022070fb7 100644 --- a/pkgs/development/python-modules/basemap/default.nix +++ b/pkgs/development/python-modules/basemap/default.nix @@ -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; { diff --git a/pkgs/development/python-modules/biopython/default.nix b/pkgs/development/python-modules/biopython/default.nix index 051f66845dec06..4c45b25ede8777 100644 --- a/pkgs/development/python-modules/biopython/default.nix +++ b/pkgs/development/python-modules/biopython/default.nix @@ -34,7 +34,6 @@ buildPythonPackage rec { checkPhase = '' runHook preCheck - export HOME=$(mktemp -d) cd Tests python run_tests.py --offline diff --git a/pkgs/development/python-modules/brian2/default.nix b/pkgs/development/python-modules/brian2/default.nix index d9f23ec574b184..1c946c61ee4eb6 100644 --- a/pkgs/development/python-modules/brian2/default.nix +++ b/pkgs/development/python-modules/brian2/default.nix @@ -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 ''; diff --git a/pkgs/development/python-modules/commonmark/default.nix b/pkgs/development/python-modules/commonmark/default.nix index 6ac907f78ab52c..292ec096cc8752 100644 --- a/pkgs/development/python-modules/commonmark/default.nix +++ b/pkgs/development/python-modules/commonmark/default.nix @@ -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 diff --git a/pkgs/development/python-modules/django-auth-ldap/default.nix b/pkgs/development/python-modules/django-auth-ldap/default.nix index 2e688abdfb07d1..ba1cbbbc7f813a 100644 --- a/pkgs/development/python-modules/django-auth-ldap/default.nix +++ b/pkgs/development/python-modules/django-auth-ldap/default.nix @@ -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 ''; diff --git a/pkgs/development/python-modules/finalfusion/default.nix b/pkgs/development/python-modules/finalfusion/default.nix index 2452a6cbf07de3..0e11459c363c17 100644 --- a/pkgs/development/python-modules/finalfusion/default.nix +++ b/pkgs/development/python-modules/finalfusion/default.nix @@ -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; { diff --git a/pkgs/development/python-modules/grip/default.nix b/pkgs/development/python-modules/grip/default.nix index f29e44d2f440d4..ce61508be2a8c5 100644 --- a/pkgs/development/python-modules/grip/default.nix +++ b/pkgs/development/python-modules/grip/default.nix @@ -52,8 +52,11 @@ buildPythonPackage rec { ]; checkPhase = '' - export PATH="$PATH:$out/bin" + runHook preCheck + py.test -xm "not assumption" + + runHook postCheck ''; meta = with lib; { diff --git a/pkgs/development/python-modules/limnoria/default.nix b/pkgs/development/python-modules/limnoria/default.nix index 3e53e25e0b1d44..6f1d4556eca78d 100644 --- a/pkgs/development/python-modules/limnoria/default.nix +++ b/pkgs/development/python-modules/limnoria/default.nix @@ -48,7 +48,6 @@ buildPythonPackage rec { checkPhase = '' runHook preCheck - export PATH="$PATH:$out/bin"; supybot-test test -v --no-network runHook postCheck ''; diff --git a/pkgs/development/python-modules/localstack/default.nix b/pkgs/development/python-modules/localstack/default.nix index 08f03e1856f8d0..4774b46eb3196c 100644 --- a/pkgs/development/python-modules/localstack/default.nix +++ b/pkgs/development/python-modules/localstack/default.nix @@ -70,7 +70,6 @@ buildPythonPackage rec { checkPhase = '' runHook preCheck - export HOME=$(mktemp -d) $out/bin/localstack --version runHook postCheck diff --git a/pkgs/development/python-modules/manhole/default.nix b/pkgs/development/python-modules/manhole/default.nix index 940dc355e4823a..f9976d33da6b92 100644 --- a/pkgs/development/python-modules/manhole/default.nix +++ b/pkgs/development/python-modules/manhole/default.nix @@ -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; { diff --git a/pkgs/development/python-modules/outlines/default.nix b/pkgs/development/python-modules/outlines/default.nix index 52ba16676fd044..d37cdf44b31ebb 100644 --- a/pkgs/development/python-modules/outlines/default.nix +++ b/pkgs/development/python-modules/outlines/default.nix @@ -57,7 +57,6 @@ buildPythonPackage rec { ]; checkPhase = '' - export HOME=$(mktemp -d) python3 -c 'import outlines' ''; diff --git a/pkgs/development/python-modules/pycflow2dot/default.nix b/pkgs/development/python-modules/pycflow2dot/default.nix index 19289d0b6cbde5..a98cd3ee9c75b0 100644 --- a/pkgs/development/python-modules/pycflow2dot/default.nix +++ b/pkgs/development/python-modules/pycflow2dot/default.nix @@ -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; { diff --git a/pkgs/development/python-modules/reno/default.nix b/pkgs/development/python-modules/reno/default.nix index 556374be325165..6372a594aa730f 100644 --- a/pkgs/development/python-modules/reno/default.nix +++ b/pkgs/development/python-modules/reno/default.nix @@ -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 diff --git a/pkgs/development/python-modules/snscrape/default.nix b/pkgs/development/python-modules/snscrape/default.nix index f9e12d45e0c28c..cbea454f135498 100644 --- a/pkgs/development/python-modules/snscrape/default.nix +++ b/pkgs/development/python-modules/snscrape/default.nix @@ -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" ]; diff --git a/pkgs/development/python-modules/stestr/tests.nix b/pkgs/development/python-modules/stestr/tests.nix index 21d1fd2c7a1e9d..a48c943f72eab6 100644 --- a/pkgs/development/python-modules/stestr/tests.nix +++ b/pkgs/development/python-modules/stestr/tests.nix @@ -18,9 +18,4 @@ buildPythonPackage { ''; nativeCheckInputs = [ stestr ]; - - checkPhase = '' - export PATH=$out/bin:$PATH - export HOME=$TMPDIR - ''; } diff --git a/pkgs/development/python-modules/subunit2sql/default.nix b/pkgs/development/python-modules/subunit2sql/default.nix index 402ee1a7bc3ec3..e262c80079bc83 100644 --- a/pkgs/development/python-modules/subunit2sql/default.nix +++ b/pkgs/development/python-modules/subunit2sql/default.nix @@ -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 @@ -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" ]; diff --git a/pkgs/development/python-modules/tempest/default.nix b/pkgs/development/python-modules/tempest/default.nix index 976b9e0a2035e9..f08e5eabf00b15 100644 --- a/pkgs/development/python-modules/tempest/default.nix +++ b/pkgs/development/python-modules/tempest/default.nix @@ -80,9 +80,10 @@ 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/* @@ -90,6 +91,8 @@ buildPythonPackage rec { stestr --test-path tempest/tests run -e <(echo " tempest.tests.lib.cli.test_execute.TestExecute.test_execute_with_prefix ") + + runHook postCheck ''; pythonImportsCheck = [ "tempest" ];