diff --git a/pkgs/applications/audio/whipper/default.nix b/pkgs/applications/audio/whipper/default.nix index f06907ad32f..dfe540f04e6 100644 --- a/pkgs/applications/audio/whipper/default.nix +++ b/pkgs/applications/audio/whipper/default.nix @@ -37,6 +37,7 @@ in python3.pkgs.buildPythonApplication rec { nativeBuildInputs = with python3.pkgs; [ setuptools-scm docutils + setuptoolsCheckHook ]; propagatedBuildInputs = with python3.pkgs; [ @@ -64,14 +65,12 @@ in python3.pkgs.buildPythonApplication rec { export SETUPTOOLS_SCM_PRETEND_VERSION="${version}" ''; - checkPhase = '' - runHook preCheck + preCheck = '' # disable tests that require internet access # https://github.com/JoeLametta/whipper/issues/291 substituteInPlace whipper/test/test_common_accurip.py \ --replace "test_AccurateRipResponse" "dont_test_AccurateRipResponse" - HOME=$TMPDIR ${python3.interpreter} -m unittest discover - runHook postCheck + export HOME=$TMPDIR ''; passthru.tests.version = testers.testVersion { diff --git a/pkgs/applications/misc/haxor-news/default.nix b/pkgs/applications/misc/haxor-news/default.nix index 9170af04e61..2f6df287197 100644 --- a/pkgs/applications/misc/haxor-news/default.nix +++ b/pkgs/applications/misc/haxor-news/default.nix @@ -52,11 +52,9 @@ buildPythonApplication rec { # will fail without pre-seeded config files doCheck = false; - checkInputs = [ mock ]; + checkInputs = [ unittestCheckHook mock ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests -v - ''; + unittestFlagsArray = [ "-s" "tests" "-v" ]; meta = with lib; { homepage = "https://github.com/donnemartin/haxor-news"; diff --git a/pkgs/applications/misc/pyditz/default.nix b/pkgs/applications/misc/pyditz/default.nix index c5f3143bedc..d986c13b84b 100644 --- a/pkgs/applications/misc/pyditz/default.nix +++ b/pkgs/applications/misc/pyditz/default.nix @@ -15,9 +15,7 @@ in buildPythonApplication rec { nativeBuildInputs = [ setuptools-scm ]; propagatedBuildInputs = [ pyyaml six jinja2 cerberus_1_1 ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { homepage = "https://pythonhosted.org/pyditz/"; diff --git a/pkgs/applications/misc/topydo/default.nix b/pkgs/applications/misc/topydo/default.nix index 352d21361b0..e7ca1a935bb 100644 --- a/pkgs/applications/misc/topydo/default.nix +++ b/pkgs/applications/misc/topydo/default.nix @@ -1,4 +1,4 @@ -{ lib, python3Packages, fetchFromGitHub, glibcLocales }: +{ lib, python3Packages, fetchFromGitHub, glibcLocales, unittestCheckHook }: with python3Packages; @@ -22,16 +22,15 @@ buildPythonApplication rec { watchdog ]; - checkInputs = [ mock freezegun pylint ]; + checkInputs = [ unittestCheckHook mock freezegun pylint ]; # Skip test that has been reported multiple times upstream without result: # bram85/topydo#271, bram85/topydo#274. - checkPhase = '' + preCheck = '' substituteInPlace test/test_revert_command.py --replace 'test_revert_ls' 'dont_test_revert_ls' - python -m unittest discover ''; - LC_ALL="en_US.UTF-8"; + LC_ALL = "en_US.UTF-8"; meta = with lib; { description = "A cli todo application compatible with the todo.txt format"; diff --git a/pkgs/development/python-modules/aioitertools/default.nix b/pkgs/development/python-modules/aioitertools/default.nix index 451fb9e7fa1..4db5cde15f6 100644 --- a/pkgs/development/python-modules/aioitertools/default.nix +++ b/pkgs/development/python-modules/aioitertools/default.nix @@ -12,7 +12,7 @@ , typing-extensions # tests -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -35,14 +35,14 @@ buildPythonPackage rec { typing-extensions ]; + checkInputs = [ + unittestCheckHook + ]; + pythonImportsCheck = [ "aioitertools" ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - meta = with lib; { description = "Implementation of itertools, builtins, and more for AsyncIO and mixed-type iterables"; license = licenses.mit; diff --git a/pkgs/development/python-modules/arxiv2bib/default.nix b/pkgs/development/python-modules/arxiv2bib/default.nix index 4dec50bbc67..54a6280017a 100644 --- a/pkgs/development/python-modules/arxiv2bib/default.nix +++ b/pkgs/development/python-modules/arxiv2bib/default.nix @@ -1,5 +1,8 @@ -{ buildPythonPackage, python, lib, fetchFromGitHub +{ buildPythonPackage +, lib +, fetchFromGitHub , mock +, unittestCheckHook }: buildPythonPackage rec { @@ -14,9 +17,8 @@ buildPythonPackage rec { sha256 = "1kp2iyx20lpc9dv4qg5fgwf83a1wx6f7hj1ldqyncg0kn9xcrhbg"; }; - checkInputs = [ mock ]; - - checkPhase = "${python.interpreter} -m unittest discover -s tests"; + checkInputs = [ unittestCheckHook mock ]; + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { description = "Get a BibTeX entry from an arXiv id number, using the arxiv.org API"; diff --git a/pkgs/development/python-modules/awesome-slugify/default.nix b/pkgs/development/python-modules/awesome-slugify/default.nix index 47ca9859b5e..884dcd4bc61 100644 --- a/pkgs/development/python-modules/awesome-slugify/default.nix +++ b/pkgs/development/python-modules/awesome-slugify/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, unidecode, regex, python }: +{ lib, buildPythonPackage, fetchPypi, unidecode, regex, unittestCheckHook }: buildPythonPackage rec { pname = "awesome-slugify"; @@ -20,9 +20,7 @@ buildPythonPackage rec { propagatedBuildInputs = [ unidecode regex ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { homepage = "https://github.com/dimka665/awesome-slugify"; diff --git a/pkgs/development/python-modules/backports_abc/default.nix b/pkgs/development/python-modules/backports_abc/default.nix index d67117613d7..684626c0780 100644 --- a/pkgs/development/python-modules/backports_abc/default.nix +++ b/pkgs/development/python-modules/backports_abc/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchPypi -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -13,9 +13,7 @@ buildPythonPackage rec { sha256 = "033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = { homepage = "https://github.com/cython/backports_abc"; diff --git a/pkgs/development/python-modules/backports_tempfile/default.nix b/pkgs/development/python-modules/backports_tempfile/default.nix index 0d1203d28be..ef4f64def3a 100644 --- a/pkgs/development/python-modules/backports_tempfile/default.nix +++ b/pkgs/development/python-modules/backports_tempfile/default.nix @@ -1,5 +1,5 @@ { lib -, python +, unittestCheckHook , buildPythonPackage , fetchPypi , setuptools-scm @@ -19,13 +19,13 @@ buildPythonPackage rec { propagatedBuildInputs = [ backports_weakref ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; - # requires https://pypi.org/project/backports.test.support doCheck = false; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; + meta = { description = "Backport of new features in Python's tempfile module"; license = lib.licenses.psfl; diff --git a/pkgs/development/python-modules/backports_weakref/default.nix b/pkgs/development/python-modules/backports_weakref/default.nix index 4db504ac330..a0cbe6d4b84 100644 --- a/pkgs/development/python-modules/backports_weakref/default.nix +++ b/pkgs/development/python-modules/backports_weakref/default.nix @@ -3,7 +3,7 @@ , fetchPypi , setuptools-scm # , backports -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -20,9 +20,9 @@ buildPythonPackage rec { # Requires backports package doCheck = false; - checkPhase = '' - ${python.interpreter} -m unittest discover tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "tests" ]; meta = with lib; { description = "Backports of new features in Python’s weakref module"; diff --git a/pkgs/development/python-modules/bitstring/default.nix b/pkgs/development/python-modules/bitstring/default.nix index 52bc9bae865..2b3fdef896b 100644 --- a/pkgs/development/python-modules/bitstring/default.nix +++ b/pkgs/development/python-modules/bitstring/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchFromGitHub -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -15,10 +15,9 @@ buildPythonPackage rec { sha256 = "0y2kcq58psvl038r6dhahhlhp1wjgr5zsms45wyz1naq6ri8x9qa"; }; - checkPhase = '' - cd test - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "test" ]; pythonImportsCheck = [ "bitstring" ]; diff --git a/pkgs/development/python-modules/clevercsv/default.nix b/pkgs/development/python-modules/clevercsv/default.nix index 21993af3eb5..5384fb01c5c 100644 --- a/pkgs/development/python-modules/clevercsv/default.nix +++ b/pkgs/development/python-modules/clevercsv/default.nix @@ -9,6 +9,7 @@ , regex , tabview , python +, unittestCheckHook }: buildPythonPackage rec { @@ -33,26 +34,29 @@ buildPythonPackage rec { tabview ]; + checkInputs = [ unittestCheckHook ]; + pythonImportsCheck = [ "clevercsv" "clevercsv.cparser" ]; - checkPhase = '' + preCheck = '' # by linking the installed version the tests also have access to compiled native libraries rm -r clevercsv ln -s $out/${python.sitePackages}/clevercsv/ clevercsv - # their ci only runs unit tests, there are also integration and fuzzing tests - ${python.interpreter} -m unittest discover -v -f -s ./tests/test_unit ''; + # their ci only runs unit tests, there are also integration and fuzzing tests + unittestFlagsArray = [ "-v" "-f" "-s" "./tests/test_unit" ]; + meta = with lib; { description = "CleverCSV is a Python package for handling messy CSV files"; longDescription = '' - CleverCSV is a Python package for handling messy CSV files. It provides - a drop-in replacement for the builtin CSV module with improved dialect - detection, and comes with a handy command line application for working - with CSV files. + CleverCSV is a Python package for handling messy CSV files. It provides + a drop-in replacement for the builtin CSV module with improved dialect + detection, and comes with a handy command line application for working + with CSV files. ''; homepage = "https://github.com/alan-turing-institute/CleverCSV"; changelog = "https://github.com/alan-turing-institute/CleverCSV/blob/master/CHANGELOG.md"; diff --git a/pkgs/development/python-modules/contextlib2/default.nix b/pkgs/development/python-modules/contextlib2/default.nix index 6aea2570cb8..456999679fc 100644 --- a/pkgs/development/python-modules/contextlib2/default.nix +++ b/pkgs/development/python-modules/contextlib2/default.nix @@ -3,6 +3,7 @@ , fetchPypi , python , pythonOlder +, unittestCheckHook }: buildPythonPackage rec { @@ -17,11 +18,7 @@ buildPythonPackage rec { hash = "sha256-qx4r/h0B2Wjht+jZAjvFHvNQm7ohe7cwzuOCfh7oKGk="; }; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "contextlib2" diff --git a/pkgs/development/python-modules/cvxopt/default.nix b/pkgs/development/python-modules/cvxopt/default.nix index dfae672f95e..31772c26935 100644 --- a/pkgs/development/python-modules/cvxopt/default.nix +++ b/pkgs/development/python-modules/cvxopt/default.nix @@ -3,8 +3,10 @@ , fetchPypi , isPyPy , python -, blas, lapack # build segfaults with 64-bit blas +, blas +, lapack # build segfaults with 64-bit blas , suitesparse +, unittestCheckHook , glpk ? null , gsl ? null , fftw ? null @@ -49,9 +51,9 @@ buildPythonPackage rec { export CVXOPT_FFTW_INC_DIR=${fftw.dev}/include ''; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { homepage = "http://cvxopt.org/"; diff --git a/pkgs/development/python-modules/cyclonedx-python-lib/default.nix b/pkgs/development/python-modules/cyclonedx-python-lib/default.nix index cd69d5b1b5e..731aef1c647 100644 --- a/pkgs/development/python-modules/cyclonedx-python-lib/default.nix +++ b/pkgs/development/python-modules/cyclonedx-python-lib/default.nix @@ -14,6 +14,7 @@ , toml , types-setuptools , types-toml +, unittestCheckHook , xmldiff }: @@ -47,6 +48,7 @@ buildPythonPackage rec { ]; checkInputs = [ + unittestCheckHook jsonschema lxml xmldiff @@ -56,13 +58,9 @@ buildPythonPackage rec { "cyclonedx" ]; - checkPhase = '' - runHook preCheck - # Tests require network access - rm tests/test_output_json.py - ${python.interpreter} -m unittest discover -s tests -v - runHook postCheck - ''; + preCheck = '' + rm tests/test_output_json.py + ''; meta = with lib; { description = "Python library for generating CycloneDX SBOMs"; diff --git a/pkgs/development/python-modules/cymem/default.nix b/pkgs/development/python-modules/cymem/default.nix index d2d010e9b12..3e5d497dbfa 100644 --- a/pkgs/development/python-modules/cymem/default.nix +++ b/pkgs/development/python-modules/cymem/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchFromGitHub , cython -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -25,10 +25,9 @@ buildPythonPackage rec { --replace "wheel>=0.32.0,<0.33.0" "wheel>=0.31.0" ''; - checkPhase = '' - cd cymem/tests - ${python.interpreter} -m unittest discover -p "*test*" - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "cymem/tests" "-p" "*test*" ]; meta = with lib; { description = "Cython memory pool for RAII-style memory management"; diff --git a/pkgs/development/python-modules/deprecation/default.nix b/pkgs/development/python-modules/deprecation/default.nix index d77554c79ab..441971fa6e7 100644 --- a/pkgs/development/python-modules/deprecation/default.nix +++ b/pkgs/development/python-modules/deprecation/default.nix @@ -5,6 +5,7 @@ , pythonAtLeast , pythonOlder , unittest2 +, unittestCheckHook }: buildPythonPackage rec { @@ -29,14 +30,10 @@ buildPythonPackage rec { # avoiding mass rebuilds for python3.9, but no longer # needed with patch - checkInputs = lib.optional (pythonOlder "3.10") [ + checkInputs = [ unittestCheckHook ] ++ lib.optional (pythonOlder "3.10") [ unittest2 ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - meta = with lib; { description = "A library to handle automated deprecations"; homepage = "https://deprecation.readthedocs.io/"; diff --git a/pkgs/development/python-modules/emailthreads/default.nix b/pkgs/development/python-modules/emailthreads/default.nix index c57e58368ff..3daaf1577e6 100644 --- a/pkgs/development/python-modules/emailthreads/default.nix +++ b/pkgs/development/python-modules/emailthreads/default.nix @@ -1,5 +1,5 @@ { lib, fetchFromGitHub, buildPythonPackage -, python, isPy3k }: +, python, isPy3k, unittestCheckHook }: buildPythonPackage rec { pname = "emailthreads"; @@ -14,11 +14,9 @@ buildPythonPackage rec { sha256 = "sha256-7BhYS1DQCW9QpG31asPCq5qPyJy+WW2onZpvEHhwQCs="; }; - PKGVER = version; + checkInputs = [ unittestCheckHook ]; - checkPhase = '' - ${python.interpreter} -m unittest discover test - ''; + PKGVER = version; meta = with lib; { homepage = "https://github.com/emersion/python-emailthreads"; diff --git a/pkgs/development/python-modules/enum34/default.nix b/pkgs/development/python-modules/enum34/default.nix index 91f54dc99cb..746e4dd314e 100644 --- a/pkgs/development/python-modules/enum34/default.nix +++ b/pkgs/development/python-modules/enum34/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchPypi , pythonAtLeast -, python +, unittestCheckHook }: if pythonAtLeast "3.4" then null else buildPythonPackage rec { @@ -14,9 +14,7 @@ if pythonAtLeast "3.4" then null else buildPythonPackage rec { sha256 = "cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { homepage = "https://pypi.python.org/pypi/enum34"; diff --git a/pkgs/development/python-modules/fastimport/default.nix b/pkgs/development/python-modules/fastimport/default.nix index bd5c270d686..d05037ca9ef 100644 --- a/pkgs/development/python-modules/fastimport/default.nix +++ b/pkgs/development/python-modules/fastimport/default.nix @@ -2,7 +2,7 @@ , pythonOlder , buildPythonPackage , fetchPypi -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -16,9 +16,7 @@ buildPythonPackage rec { sha256 = "6ac99dda4e7b0b3ae831507b6d0094802e6dd95891feafde8cc5c405b6c149ca"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "fastimport" ]; diff --git a/pkgs/development/python-modules/fido2/default.nix b/pkgs/development/python-modules/fido2/default.nix index 129d1863923..26ccd95054c 100644 --- a/pkgs/development/python-modules/fido2/default.nix +++ b/pkgs/development/python-modules/fido2/default.nix @@ -5,6 +5,7 @@ , cryptography , mock , pyfakefs +, unittestCheckHook }: buildPythonPackage rec { @@ -18,17 +19,9 @@ buildPythonPackage rec { propagatedBuildInputs = [ six cryptography ]; - checkInputs = [ mock pyfakefs ]; + checkInputs = [ unittestCheckHook mock pyfakefs ]; - # Testing with `python setup.py test` doesn't work: - # https://github.com/Yubico/python-fido2/issues/108#issuecomment-763513576 - checkPhase = '' - runHook preCheck - - python -m unittest discover -v - - runHook postCheck - ''; + unittestFlagsArray = [ "-v" ]; pythonImportsCheck = [ "fido2" ]; diff --git a/pkgs/development/python-modules/flask-babel/default.nix b/pkgs/development/python-modules/flask-babel/default.nix index a538327650b..9a2aef0570e 100644 --- a/pkgs/development/python-modules/flask-babel/default.nix +++ b/pkgs/development/python-modules/flask-babel/default.nix @@ -1,6 +1,6 @@ { lib , buildPythonPackage -, python +, unittestCheckHook , fetchPypi , flask , babel @@ -26,9 +26,7 @@ buildPythonPackage rec { speaklater ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { description = "Adds i18n/l10n support to Flask applications"; diff --git a/pkgs/development/python-modules/flask-bcrypt/default.nix b/pkgs/development/python-modules/flask-bcrypt/default.nix index 1c09b6d809c..fc80c501904 100644 --- a/pkgs/development/python-modules/flask-bcrypt/default.nix +++ b/pkgs/development/python-modules/flask-bcrypt/default.nix @@ -3,7 +3,7 @@ , fetchFromGitHub , flask , bcrypt -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -22,11 +22,7 @@ buildPythonPackage rec { bcrypt ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "flask_bcrypt" diff --git a/pkgs/development/python-modules/flask-migrate/default.nix b/pkgs/development/python-modules/flask-migrate/default.nix index 04532032038..63047c98fdf 100644 --- a/pkgs/development/python-modules/flask-migrate/default.nix +++ b/pkgs/development/python-modules/flask-migrate/default.nix @@ -6,7 +6,7 @@ , flask , flask_script , flask-sqlalchemy -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -33,15 +33,10 @@ buildPythonPackage rec { ]; checkInputs = [ + unittestCheckHook flask_script ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; - meta = with lib; { description = "SQLAlchemy database migrations for Flask applications using Alembic"; homepage = "https://github.com/miguelgrinberg/Flask-Migrate"; diff --git a/pkgs/development/python-modules/flask-seasurf/default.nix b/pkgs/development/python-modules/flask-seasurf/default.nix index 6d09d7ec45c..cebc4bfa89a 100644 --- a/pkgs/development/python-modules/flask-seasurf/default.nix +++ b/pkgs/development/python-modules/flask-seasurf/default.nix @@ -1,4 +1,4 @@ -{ lib, fetchFromGitHub, buildPythonPackage, isPy3k, flask, mock, python }: +{ lib, fetchFromGitHub, buildPythonPackage, isPy3k, flask, mock, unittestCheckHook }: buildPythonPackage rec { pname = "Flask-SeaSurf"; @@ -15,15 +15,10 @@ buildPythonPackage rec { propagatedBuildInputs = [ flask ]; checkInputs = [ + unittestCheckHook mock ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; - pythonImportsCheck = [ "flask_seasurf" ]; meta = with lib; { diff --git a/pkgs/development/python-modules/gb-io/default.nix b/pkgs/development/python-modules/gb-io/default.nix index 4aab9d1bc6f..6a44b758d29 100644 --- a/pkgs/development/python-modules/gb-io/default.nix +++ b/pkgs/development/python-modules/gb-io/default.nix @@ -4,6 +4,7 @@ , buildPythonPackage , rustPlatform , setuptools-rust +, unittestCheckHook }: buildPythonPackage rec { @@ -31,9 +32,7 @@ buildPythonPackage rec { rust.rustc ]); - checkPhase = '' - python -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "gb_io" ]; diff --git a/pkgs/development/python-modules/greenlet/default.nix b/pkgs/development/python-modules/greenlet/default.nix index 78ac1668b6f..4264a825261 100644 --- a/pkgs/development/python-modules/greenlet/default.nix +++ b/pkgs/development/python-modules/greenlet/default.nix @@ -2,31 +2,29 @@ , buildPythonPackage , fetchPypi , isPyPy -, python +, unittestCheckHook }: buildPythonPackage rec { pname = "greenlet"; version = "1.1.2"; - disabled = isPyPy; # builtin for pypy + disabled = isPyPy; # builtin for pypy src = fetchPypi { inherit pname version; sha256 = "e30f5ea4ae2346e62cedde8794a56858a67b878dd79f7df76a0767e356b1744a"; }; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover -v greenlet.tests - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-v" "greenlet.tests" ]; meta = with lib; { homepage = "https://github.com/python-greenlet/greenlet"; description = "Module for lightweight in-process concurrent programming"; license = with licenses; [ - psfl # src/greenlet/slp_platformselect.h & files in src/greenlet/platform/ directory + psfl # src/greenlet/slp_platformselect.h & files in src/greenlet/platform/ directory mit ]; }; diff --git a/pkgs/development/python-modules/gruut-ipa/default.nix b/pkgs/development/python-modules/gruut-ipa/default.nix index f0824670731..2b8ed6709ac 100644 --- a/pkgs/development/python-modules/gruut-ipa/default.nix +++ b/pkgs/development/python-modules/gruut-ipa/default.nix @@ -4,6 +4,7 @@ , espeak , numpy , python +, unittestCheckHook }: buildPythonPackage rec { @@ -29,11 +30,7 @@ buildPythonPackage rec { numpy ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "gruut_ipa" diff --git a/pkgs/development/python-modules/importlib-resources/default.nix b/pkgs/development/python-modules/importlib-resources/default.nix index 2eb41c4c504..89537a8dfa2 100644 --- a/pkgs/development/python-modules/importlib-resources/default.nix +++ b/pkgs/development/python-modules/importlib-resources/default.nix @@ -6,7 +6,7 @@ , importlib-metadata , typing ? null , pythonOlder -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -31,9 +31,9 @@ buildPythonPackage rec { typing ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ + unittestCheckHook + ]; pythonImportsCheck = [ "importlib_resources" diff --git a/pkgs/development/python-modules/isodate/default.nix b/pkgs/development/python-modules/isodate/default.nix index 21bcc3ed90a..ba507f168db 100644 --- a/pkgs/development/python-modules/isodate/default.nix +++ b/pkgs/development/python-modules/isodate/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchPypi -, python +, unittestCheckHook , six }: @@ -16,9 +16,9 @@ buildPythonPackage rec { propagatedBuildInputs = [ six ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s src/isodate/tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "src/isodate/tests" ]; meta = with lib; { description = "ISO 8601 date/time parser"; diff --git a/pkgs/development/python-modules/jxmlease/default.nix b/pkgs/development/python-modules/jxmlease/default.nix index 5036ede5e5e..19b29bf7639 100644 --- a/pkgs/development/python-modules/jxmlease/default.nix +++ b/pkgs/development/python-modules/jxmlease/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchPypi , lxml -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -22,11 +22,9 @@ buildPythonPackage rec { # https://github.com/Juniper/jxmlease/issues/26 doCheck = false; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover -v - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-v" ]; meta = with lib; { description = "Converts between XML and intelligent Python data structures"; diff --git a/pkgs/development/python-modules/karton-asciimagic/default.nix b/pkgs/development/python-modules/karton-asciimagic/default.nix index 3ebba4202b3..74cfa7f8b53 100644 --- a/pkgs/development/python-modules/karton-asciimagic/default.nix +++ b/pkgs/development/python-modules/karton-asciimagic/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchFromGitHub , karton-core -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -20,11 +20,7 @@ buildPythonPackage rec { karton-core ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "karton.asciimagic" ]; diff --git a/pkgs/development/python-modules/karton-core/default.nix b/pkgs/development/python-modules/karton-core/default.nix index d4e95481327..9a25f3cf123 100644 --- a/pkgs/development/python-modules/karton-core/default.nix +++ b/pkgs/development/python-modules/karton-core/default.nix @@ -2,7 +2,7 @@ , boto3 , buildPythonPackage , fetchFromGitHub -, python +, unittestCheckHook , redis }: @@ -22,11 +22,7 @@ buildPythonPackage rec { redis ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "karton.core" diff --git a/pkgs/development/python-modules/karton-yaramatcher/default.nix b/pkgs/development/python-modules/karton-yaramatcher/default.nix index 16b4036c90c..67f99af39d9 100644 --- a/pkgs/development/python-modules/karton-yaramatcher/default.nix +++ b/pkgs/development/python-modules/karton-yaramatcher/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchFromGitHub , karton-core -, python +, unittestCheckHook , yara-python }: @@ -22,11 +22,7 @@ buildPythonPackage rec { yara-python ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "karton.yaramatcher" ]; diff --git a/pkgs/development/python-modules/kbcstorage/default.nix b/pkgs/development/python-modules/kbcstorage/default.nix index 913b7981edd..d84ee1994b5 100644 --- a/pkgs/development/python-modules/kbcstorage/default.nix +++ b/pkgs/development/python-modules/kbcstorage/default.nix @@ -12,7 +12,7 @@ # tests , responses -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -44,15 +44,10 @@ buildPythonPackage rec { doCheck = false; checkInputs = [ + unittestCheckHook responses ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; - pythonImportsCheck = [ "kbcstorage" "kbcstorage.buckets" diff --git a/pkgs/development/python-modules/markdown/default.nix b/pkgs/development/python-modules/markdown/default.nix index 7207edb5815..999fe2682b8 100644 --- a/pkgs/development/python-modules/markdown/default.nix +++ b/pkgs/development/python-modules/markdown/default.nix @@ -4,7 +4,7 @@ , fetchPypi , importlib-metadata , pyyaml -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -25,11 +25,7 @@ buildPythonPackage rec { importlib-metadata ]; - checkInputs = [ pyyaml ]; - - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook pyyaml ]; pythonImportsCheck = [ "markdown" ]; diff --git a/pkgs/development/python-modules/mat2/default.nix b/pkgs/development/python-modules/mat2/default.nix index cd11b56ac26..59a1dddc22b 100644 --- a/pkgs/development/python-modules/mat2/default.nix +++ b/pkgs/development/python-modules/mat2/default.nix @@ -1,7 +1,7 @@ { lib , stdenv , buildPythonPackage -, python +, unittestCheckHook , pythonOlder , fetchFromGitLab , substituteAll @@ -17,7 +17,8 @@ , mutagen , pygobject3 , pycairo -, dolphinIntegration ? false, plasma5Packages +, dolphinIntegration ? false +, plasma5Packages }: buildPythonPackage rec { @@ -92,9 +93,9 @@ buildPythonPackage rec { install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus" ''; - checkPhase = '' - ${python.interpreter} -m unittest discover -v - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-v" ]; meta = with lib; { description = "A handy tool to trash your metadata"; diff --git a/pkgs/development/python-modules/maxcube-api/default.nix b/pkgs/development/python-modules/maxcube-api/default.nix index 36bcc35fc03..0627667a4e5 100644 --- a/pkgs/development/python-modules/maxcube-api/default.nix +++ b/pkgs/development/python-modules/maxcube-api/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , pythonOlder , fetchFromGitHub -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -22,17 +22,13 @@ buildPythonPackage rec { substituteInPlace setup.py --replace "license=license" "license='MIT'" ''; + checkInputs = [ unittestCheckHook ]; + pythonImportsCheck = [ "maxcube" "maxcube.cube" ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; - meta = with lib; { description = "eQ-3/ELV MAX! Cube Python API"; homepage = "https://github.com/hackercowboy/python-maxcube-api"; diff --git a/pkgs/development/python-modules/mdutils/default.nix b/pkgs/development/python-modules/mdutils/default.nix index 08ea5eb8b6f..f2b14258931 100644 --- a/pkgs/development/python-modules/mdutils/default.nix +++ b/pkgs/development/python-modules/mdutils/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchFromGitHub -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -15,11 +15,7 @@ buildPythonPackage rec { sha256 = "sha256-regIrMWbGmW574dfojxZFJoivpaqOpN1I6YsqLEp8BM="; }; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Set of basic tools that can help to create Markdown files"; diff --git a/pkgs/development/python-modules/mkdocs/default.nix b/pkgs/development/python-modules/mkdocs/default.nix index 2345ca93f94..0fb61bd8a59 100644 --- a/pkgs/development/python-modules/mkdocs/default.nix +++ b/pkgs/development/python-modules/mkdocs/default.nix @@ -18,7 +18,7 @@ # testing deps , babel , mock -, pytestCheckHook +, unittestCheckHook }: buildPythonPackage rec { @@ -47,20 +47,12 @@ buildPythonPackage rec { ]; checkInputs = [ + unittestCheckHook babel mock ]; - - checkPhase = '' - set -euo pipefail - - runHook preCheck - - python -m unittest discover -v -p '*tests.py' mkdocs --top-level-directory . - - runHook postCheck - ''; + unittestFlagsArray = [ "-v" "-p" "'*tests.py'" "mkdocs" ]; pythonImportsCheck = [ "mkdocs" ]; diff --git a/pkgs/development/python-modules/mock/default.nix b/pkgs/development/python-modules/mock/default.nix index 464a6ae969d..d23ae8d30c9 100644 --- a/pkgs/development/python-modules/mock/default.nix +++ b/pkgs/development/python-modules/mock/default.nix @@ -5,6 +5,7 @@ , python , pythonOlder , pytest +, unittestCheckHook }: buildPythonPackage rec { @@ -26,11 +27,8 @@ buildPythonPackage rec { }) ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - checkInputs = [ + unittestCheckHook pytest ]; diff --git a/pkgs/development/python-modules/mwdblib/default.nix b/pkgs/development/python-modules/mwdblib/default.nix index db81e951cf2..69a191f16f9 100644 --- a/pkgs/development/python-modules/mwdblib/default.nix +++ b/pkgs/development/python-modules/mwdblib/default.nix @@ -6,7 +6,7 @@ , fetchFromGitHub , humanize , keyring -, python +, unittestCheckHook , python-dateutil , pythonOlder , requests @@ -36,11 +36,7 @@ buildPythonPackage rec { requests ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "mwdblib" diff --git a/pkgs/development/python-modules/mypy/extensions.nix b/pkgs/development/python-modules/mypy/extensions.nix index 04b22e2c543..37257efe5ed 100644 --- a/pkgs/development/python-modules/mypy/extensions.nix +++ b/pkgs/development/python-modules/mypy/extensions.nix @@ -2,7 +2,7 @@ , fetchFromGitHub , buildPythonPackage , typing -, python +, unittestCheckHook , pythonOlder }: @@ -19,9 +19,9 @@ buildPythonPackage rec { propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing; - checkPhase = '' - ${python.interpreter} -m unittest discover tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "tests" ]; pythonImportsCheck = [ "mypy_extensions" ]; diff --git a/pkgs/development/python-modules/nix-prefetch-github/default.nix b/pkgs/development/python-modules/nix-prefetch-github/default.nix index 7ef63348dfb..d6cc7419085 100644 --- a/pkgs/development/python-modules/nix-prefetch-github/default.nix +++ b/pkgs/development/python-modules/nix-prefetch-github/default.nix @@ -4,6 +4,7 @@ , git , which , pythonOlder +, unittestCheckHook }: buildPythonPackage rec { @@ -19,11 +20,8 @@ buildPythonPackage rec { sha256 = "GHUH3Oog800qrdgXs5AEa4O6ovZ1LT0k3P4YwEHfwlY="; }; - checkInputs = [ git which ]; + checkInputs = [ unittestCheckHook git which ]; - checkPhase = '' - python -m unittest discover - ''; # ignore tests which are impure DISABLED_TESTS = "network requires_nix_build"; diff --git a/pkgs/development/python-modules/pathlib/default.nix b/pkgs/development/python-modules/pathlib/default.nix index cf4dd0999d4..b29a5bae8ed 100644 --- a/pkgs/development/python-modules/pathlib/default.nix +++ b/pkgs/development/python-modules/pathlib/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchPypi -, python +, unittestCheckHook , pythonAtLeast }: @@ -15,9 +15,7 @@ buildPythonPackage rec { sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = { description = "Object-oriented filesystem paths"; diff --git a/pkgs/development/python-modules/pgsanity/default.nix b/pkgs/development/python-modules/pgsanity/default.nix index 26e5eb2bd6a..82d636979e1 100644 --- a/pkgs/development/python-modules/pgsanity/default.nix +++ b/pkgs/development/python-modules/pgsanity/default.nix @@ -2,7 +2,9 @@ , python , fetchPypi , buildPythonPackage -, postgresql }: +, postgresql +, unittestCheckHook +}: buildPythonPackage rec { pname = "pgsanity"; @@ -13,11 +15,7 @@ buildPythonPackage rec { sha256 = "de0bbd6fe4f98bf5139cb5f466eac2e2abaf5a7b050b9e4867b87bf360873173"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover -s test - ''; - - checkInputs = [ postgresql ]; + checkInputs = [ unittestCheckHook postgresql ]; propagatedBuildInputs = [ postgresql ]; meta = with lib; { diff --git a/pkgs/development/python-modules/plac/default.nix b/pkgs/development/python-modules/plac/default.nix index 4c353ab7a4e..f9d373e68db 100644 --- a/pkgs/development/python-modules/plac/default.nix +++ b/pkgs/development/python-modules/plac/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchPypi -, python +, unittestCheckHook , pythonOlder }: @@ -17,10 +17,9 @@ buildPythonPackage rec { hash = "sha256-OL3YZNBFD7dIGTqoF7nEWKj1MZ+/l7ImEVHPwKWBIJA="; }; - checkPhase = '' - cd doc - ${python.interpreter} -m unittest discover -p "*test_plac*" - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "doc" "-p" "*test_plac*" ]; pythonImportsCheck = [ "plac" diff --git a/pkgs/development/python-modules/pulsectl/default.nix b/pkgs/development/python-modules/pulsectl/default.nix index 1990915eef4..e895a0920e5 100644 --- a/pkgs/development/python-modules/pulsectl/default.nix +++ b/pkgs/development/python-modules/pulsectl/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, libpulseaudio, glibc, substituteAll, stdenv, pulseaudio, python }: +{ lib, buildPythonPackage, fetchPypi, libpulseaudio, glibc, substituteAll, stdenv, pulseaudio, unittestCheckHook }: buildPythonPackage rec { pname = "pulsectl"; @@ -22,11 +22,10 @@ buildPythonPackage rec { "pulsectl" ]; - checkInputs = [ pulseaudio ]; + checkInputs = [ unittestCheckHook pulseaudio ]; - checkPhase = '' + preCheck = '' export HOME=$TMPDIR - ${python.interpreter} -m unittest discover ''; meta = with lib; { diff --git a/pkgs/development/python-modules/pycparser/default.nix b/pkgs/development/python-modules/pycparser/default.nix index c8283f93c51..47f1a20fbb2 100644 --- a/pkgs/development/python-modules/pycparser/default.nix +++ b/pkgs/development/python-modules/pycparser/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, python }: +{ lib, buildPythonPackage, fetchPypi, unittestCheckHook }: buildPythonPackage rec { pname = "pycparser"; @@ -9,9 +9,9 @@ buildPythonPackage rec { sha256 = "e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { description = "C parser in Python"; diff --git a/pkgs/development/python-modules/pypdf2/default.nix b/pkgs/development/python-modules/pypdf2/default.nix index 2ae89bf43f0..ea32a40c60e 100644 --- a/pkgs/development/python-modules/pypdf2/default.nix +++ b/pkgs/development/python-modules/pypdf2/default.nix @@ -4,7 +4,7 @@ , pythonOlder , glibcLocales , typing-extensions -, python +, unittestCheckHook , isPy3k }: @@ -24,13 +24,11 @@ buildPythonPackage rec { typing-extensions ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - # Tests broken on Python 3.x #doCheck = !(isPy3k); + checkInputs = [ unittestCheckHook ]; + meta = with lib; { description = "A Pure-Python library built as a PDF toolkit"; homepage = "http://mstamy2.github.com/PyPDF2/"; diff --git a/pkgs/development/python-modules/pyrad/default.nix b/pkgs/development/python-modules/pyrad/default.nix index c8fb0310548..97c8b6895c3 100644 --- a/pkgs/development/python-modules/pyrad/default.nix +++ b/pkgs/development/python-modules/pyrad/default.nix @@ -5,7 +5,7 @@ , poetry-core , netaddr , six -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -43,11 +43,9 @@ buildPythonPackage rec { --replace "def testBindv6(self):" "def dontTestBindv6(self):" ''; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ + unittestCheckHook + ]; pythonImportsCheck = [ "pyrad" diff --git a/pkgs/development/python-modules/pysensors/default.nix b/pkgs/development/python-modules/pysensors/default.nix index 8cff62b89c1..e7d3697da0f 100644 --- a/pkgs/development/python-modules/pysensors/default.nix +++ b/pkgs/development/python-modules/pysensors/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, python, fetchFromGitHub, lm_sensors }: +{ lib, buildPythonPackage, unittestCheckHook, fetchFromGitHub, lm_sensors }: buildPythonPackage { version = "2017-07-13"; pname = "pysensors"; @@ -17,10 +17,9 @@ buildPythonPackage { # due to sandboxing doCheck = false; - checkPhase = '' - cd tests - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { maintainers = with maintainers; [ guibou ]; diff --git a/pkgs/development/python-modules/pyserial/default.nix b/pkgs/development/python-modules/pyserial/default.nix index e6b8edb784a..7eed44d0fbb 100644 --- a/pkgs/development/python-modules/pyserial/default.nix +++ b/pkgs/development/python-modules/pyserial/default.nix @@ -2,7 +2,7 @@ , stdenv , buildPythonPackage , fetchPypi -, python +, unittestCheckHook , pythonOlder , isPy3k }: @@ -27,11 +27,9 @@ buildPythonPackage rec { doCheck = !stdenv.hostPlatform.isDarwin; # broken on darwin - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover -s test - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "test" ]; pythonImportsCheck = [ "serial" diff --git a/pkgs/development/python-modules/pystache/default.nix b/pkgs/development/python-modules/pystache/default.nix index 67ee0063827..b3270c5e733 100644 --- a/pkgs/development/python-modules/pystache/default.nix +++ b/pkgs/development/python-modules/pystache/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, python, fetchPypi, isPy3k, glibcLocales }: +{ lib, buildPythonPackage, unittestCheckHook, fetchPypi, isPy3k, glibcLocales }: buildPythonPackage rec { pname = "pystache"; @@ -13,14 +13,12 @@ buildPythonPackage rec { buildInputs = [ glibcLocales ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - # SyntaxError Python 3 # https://github.com/defunkt/pystache/issues/181 doCheck = !isPy3k; + checkInputs = [ unittestCheckHook ]; + meta = with lib; { description = "A framework-agnostic, logic-free templating system inspired by ctemplate and et"; homepage = "https://github.com/defunkt/pystache"; diff --git a/pkgs/development/python-modules/python-keycloak/default.nix b/pkgs/development/python-modules/python-keycloak/default.nix index 6425869243e..0d2be6a4d14 100644 --- a/pkgs/development/python-modules/python-keycloak/default.nix +++ b/pkgs/development/python-modules/python-keycloak/default.nix @@ -4,6 +4,7 @@ , requests , python-jose , httmock +, unittestCheckHook }: buildPythonPackage rec { @@ -23,13 +24,10 @@ buildPythonPackage rec { ]; checkInputs = [ + unittestCheckHook httmock ]; - checkPhase = '' - python -m unittest discover - ''; - pythonImportsCheck = [ "keycloak" ]; meta = with lib; { diff --git a/pkgs/development/python-modules/python-snappy/default.nix b/pkgs/development/python-modules/python-snappy/default.nix index 397fcaa3dd0..d75c80d5e41 100644 --- a/pkgs/development/python-modules/python-snappy/default.nix +++ b/pkgs/development/python-modules/python-snappy/default.nix @@ -4,7 +4,7 @@ , isPyPy , snappy , cffi -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -21,11 +21,7 @@ buildPythonPackage rec { propagatedBuildInputs = lib.optional isPyPy cffi; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Python library for the snappy compression library from Google"; diff --git a/pkgs/development/python-modules/pytidylib/default.nix b/pkgs/development/python-modules/pytidylib/default.nix index 16f6e4232b3..15280fff4b0 100644 --- a/pkgs/development/python-modules/pytidylib/default.nix +++ b/pkgs/development/python-modules/pytidylib/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, buildPythonPackage, fetchPypi, python, html-tidy }: +{ lib, stdenv, buildPythonPackage, fetchPypi, unittestCheckHook, html-tidy }: buildPythonPackage rec { pname = "pytidylib"; @@ -21,9 +21,7 @@ buildPythonPackage rec { $' @unittest.skip("")\n def test_large_document(self):' ''; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Python wrapper for HTML Tidy (tidylib) on Python 2 and 3"; diff --git a/pkgs/development/python-modules/pytz/default.nix b/pkgs/development/python-modules/pytz/default.nix index 27b18845804..58ac098c17c 100644 --- a/pkgs/development/python-modules/pytz/default.nix +++ b/pkgs/development/python-modules/pytz/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, python }: +{ lib, buildPythonPackage, fetchPypi, unittestCheckHook }: buildPythonPackage rec { pname = "pytz"; @@ -9,9 +9,9 @@ buildPythonPackage rec { sha256 = "sha256-HnYOL+aoFjvAs9mhnE+ENCr6Cir/6/qoSwG5eKAuyqc="; }; - checkPhase = '' - ${python.interpreter} -m unittest discover -s pytz/tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "pytz/tests" ]; pythonImportsCheck = [ "pytz" ]; diff --git a/pkgs/development/python-modules/readlike/default.nix b/pkgs/development/python-modules/readlike/default.nix index f2e3d11e7ed..fae5b1a7872 100644 --- a/pkgs/development/python-modules/readlike/default.nix +++ b/pkgs/development/python-modules/readlike/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchFromGitHub -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -15,9 +15,9 @@ buildPythonPackage rec { sha256 = "1mw8j8ads8hqdbz42siwpffi4wi5s33z9g14a5c2i7vxp8m68qc1"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { description = "GNU Readline-like line editing module"; diff --git a/pkgs/development/python-modules/sjcl/default.nix b/pkgs/development/python-modules/sjcl/default.nix index 41da6669b54..0ef52c65713 100644 --- a/pkgs/development/python-modules/sjcl/default.nix +++ b/pkgs/development/python-modules/sjcl/default.nix @@ -3,7 +3,7 @@ , fetchFromGitHub , pythonOlder , pycryptodome -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -23,11 +23,7 @@ buildPythonPackage rec { propagatedBuildInputs = [ pycryptodome ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "sjcl" diff --git a/pkgs/development/python-modules/sphinx-testing/default.nix b/pkgs/development/python-modules/sphinx-testing/default.nix index 1a8521bf438..daf90bb3b50 100644 --- a/pkgs/development/python-modules/sphinx-testing/default.nix +++ b/pkgs/development/python-modules/sphinx-testing/default.nix @@ -4,7 +4,7 @@ , mock , sphinx , six -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -16,12 +16,10 @@ buildPythonPackage rec { sha256 = "ef661775b5722d7b00f67fc229104317d35637a4fb4434bf2c005afdf1da4d09"; }; - checkInputs = [ mock ]; + checkInputs = [ unittestCheckHook mock ]; propagatedBuildInputs = [ sphinx six ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + unittestFlagsArray = [ "-s" "tests" ]; # Test failures https://github.com/sphinx-doc/sphinx-testing/issues/5 doCheck = false; diff --git a/pkgs/development/python-modules/sphinxcontrib-blockdiag/default.nix b/pkgs/development/python-modules/sphinxcontrib-blockdiag/default.nix index 0b26c24319f..61b44aa2b70 100644 --- a/pkgs/development/python-modules/sphinxcontrib-blockdiag/default.nix +++ b/pkgs/development/python-modules/sphinxcontrib-blockdiag/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchPypi -, python +, unittestCheckHook , mock , sphinx-testing , sphinx @@ -22,9 +22,10 @@ buildPythonPackage rec { # Seems to look for files in the wrong dir doCheck = false; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { description = "Sphinx blockdiag extension"; diff --git a/pkgs/development/python-modules/tabview/default.nix b/pkgs/development/python-modules/tabview/default.nix index 35a7f7d8a7d..6123dc8a056 100644 --- a/pkgs/development/python-modules/tabview/default.nix +++ b/pkgs/development/python-modules/tabview/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchFromGitHub -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -17,9 +17,7 @@ buildPythonPackage rec { sha256 = "1d1l8fhdn3w2zg7wakvlmjmgjh9lh9h5fal1clgyiqmhfix4cn4m"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Python curses command line CSV and tabular data viewer"; diff --git a/pkgs/development/python-modules/tomli/default.nix b/pkgs/development/python-modules/tomli/default.nix index c9c9cb46b2c..24a3b2f51f0 100644 --- a/pkgs/development/python-modules/tomli/default.nix +++ b/pkgs/development/python-modules/tomli/default.nix @@ -3,9 +3,9 @@ , callPackage , fetchFromGitHub , flit-core -, python +, unittestCheckHook -# important downstream dependencies + # important downstream dependencies , flit , black , mypy @@ -26,13 +26,9 @@ buildPythonPackage rec { nativeBuildInputs = [ flit-core ]; - pythonImportsCheck = [ "tomli" ]; + checkInputs = [ unittestCheckHook ]; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + pythonImportsCheck = [ "tomli" ]; passthru.tests = { # test downstream dependencies diff --git a/pkgs/development/python-modules/tornado/4.nix b/pkgs/development/python-modules/tornado/4.nix index 3be82e40a29..5765dee4415 100644 --- a/pkgs/development/python-modules/tornado/4.nix +++ b/pkgs/development/python-modules/tornado/4.nix @@ -1,26 +1,27 @@ { lib -, python +, unittestCheckHook , buildPythonPackage , fetchPypi , isPy27 +, pythonAtLeast }: buildPythonPackage rec { pname = "tornado"; version = "4.5.3"; - disabled = isPy27 || python.pythonAtLeast "3.10"; - - # We specify the name of the test files to prevent - # https://github.com/NixOS/nixpkgs/issues/14634 - checkPhase = '' - ${python.interpreter} -m unittest discover *_test.py - ''; + disabled = isPy27 || pythonAtLeast "3.10"; src = fetchPypi { inherit pname version; sha256 = "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d"; }; + checkInputs = [ unittestCheckHook ]; + + # We specify the name of the test files to prevent + # https://github.com/NixOS/nixpkgs/issues/14634 + unittestFlagsArray = [ "*_test.py" ]; + __darwinAllowLocalNetworking = true; meta = { diff --git a/pkgs/development/python-modules/tornado/5.nix b/pkgs/development/python-modules/tornado/5.nix index f0dc14b5fa2..5dfb4f80542 100644 --- a/pkgs/development/python-modules/tornado/5.nix +++ b/pkgs/development/python-modules/tornado/5.nix @@ -1,5 +1,5 @@ { lib -, python +, unittestCheckHook , buildPythonPackage , fetchPypi , isPy27 @@ -11,17 +11,17 @@ buildPythonPackage rec { version = "5.1.1"; disabled = isPy27 || pythonAtLeast "3.10"; - # We specify the name of the test files to prevent - # https://github.com/NixOS/nixpkgs/issues/14634 - checkPhase = '' - ${python.interpreter} -m unittest discover *_test.py - ''; - src = fetchPypi { inherit pname version; sha256 = "4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409"; }; + checkInputs = [ unittestCheckHook ]; + + # We specify the name of the test files to prevent + # https://github.com/NixOS/nixpkgs/issues/14634 + unittestFlagsArray = [ "*_test.py" ]; + __darwinAllowLocalNetworking = true; meta = { diff --git a/pkgs/development/python-modules/trytond/default.nix b/pkgs/development/python-modules/trytond/default.nix index df877a2e702..4d0fc2908e6 100644 --- a/pkgs/development/python-modules/trytond/default.nix +++ b/pkgs/development/python-modules/trytond/default.nix @@ -18,8 +18,9 @@ , weasyprint , gevent , pillow -, withPostgresql ? true, psycopg2 -, python +, withPostgresql ? true +, psycopg2 +, unittestCheckHook }: buildPythonPackage rec { @@ -54,21 +55,20 @@ buildPythonPackage rec { gevent pillow ] ++ relatorio.optional-dependencies.fodt - ++ passlib.optional-dependencies.bcrypt - ++ passlib.optional-dependencies.argon2 - ++ lib.optional withPostgresql psycopg2; + ++ passlib.optional-dependencies.bcrypt + ++ passlib.optional-dependencies.argon2 + ++ lib.optional withPostgresql psycopg2; - checkPhase = '' - runHook preCheck + checkInputs = [ unittestCheckHook ]; + preCheck = '' export HOME=$(mktemp -d) export TRYTOND_DATABASE_URI="sqlite://" export DB_NAME=":memory:"; - ${python.interpreter} -m unittest discover -s trytond.tests - - runHook postCheck ''; + unittestFlagsArray = [ "-s" "trytond.tests" ]; + meta = with lib; { description = "The server of the Tryton application platform"; longDescription = '' diff --git a/pkgs/development/python-modules/txrequests/default.nix b/pkgs/development/python-modules/txrequests/default.nix index cf3bee52c59..eaf94e21ee3 100644 --- a/pkgs/development/python-modules/txrequests/default.nix +++ b/pkgs/development/python-modules/txrequests/default.nix @@ -4,7 +4,7 @@ , twisted , requests , cryptography -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -21,9 +21,7 @@ buildPythonPackage rec { # Require network access doCheck = false; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Asynchronous Python HTTP for Humans."; diff --git a/pkgs/development/python-modules/u-msgpack-python/default.nix b/pkgs/development/python-modules/u-msgpack-python/default.nix index f44b7db455b..1a82fe4b70a 100644 --- a/pkgs/development/python-modules/u-msgpack-python/default.nix +++ b/pkgs/development/python-modules/u-msgpack-python/default.nix @@ -2,7 +2,7 @@ , lib , fetchPypi , glibcLocales -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -18,9 +18,7 @@ buildPythonPackage rec { buildInputs = [ glibcLocales ]; - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; meta = { description = "A portable, lightweight MessagePack serializer and deserializer written in pure Python"; diff --git a/pkgs/development/python-modules/unidiff/default.nix b/pkgs/development/python-modules/unidiff/default.nix index 8fe8a760cf0..2fea8dca66f 100644 --- a/pkgs/development/python-modules/unidiff/default.nix +++ b/pkgs/development/python-modules/unidiff/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, python }: +{ lib, buildPythonPackage, fetchPypi, unittestCheckHook }: buildPythonPackage rec { pname = "unidiff"; @@ -9,9 +9,9 @@ buildPythonPackage rec { sha256 = "2bbcbc986e1fb97f04b1d7b864aa6002ab02f4d8a996bf03aa6e5a81447d1fc5"; }; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests/ - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; pythonImportsCheck = [ "unidiff" ]; diff --git a/pkgs/development/python-modules/unify/default.nix b/pkgs/development/python-modules/unify/default.nix index a1061ad9df9..45b75571170 100644 --- a/pkgs/development/python-modules/unify/default.nix +++ b/pkgs/development/python-modules/unify/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchFromGitHub , untokenize -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -19,7 +19,7 @@ buildPythonPackage rec { propagatedBuildInputs = [ untokenize ]; - checkPhase = "${python.interpreter} -m unittest discover"; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Modifies strings to all use the same quote where possible"; diff --git a/pkgs/development/python-modules/untangle/default.nix b/pkgs/development/python-modules/untangle/default.nix index 6582f5080bd..22472549e6c 100644 --- a/pkgs/development/python-modules/untangle/default.nix +++ b/pkgs/development/python-modules/untangle/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchFromGitHub, python, defusedxml }: +{ lib, buildPythonPackage, fetchFromGitHub, unittestCheckHook, defusedxml }: buildPythonPackage rec { pname = "untangle"; @@ -16,9 +16,9 @@ buildPythonPackage rec { defusedxml ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; meta = with lib; { description = "Convert XML documents into Python objects"; diff --git a/pkgs/development/python-modules/untokenize/default.nix b/pkgs/development/python-modules/untokenize/default.nix index 55becfeac4e..2977ffd76e5 100644 --- a/pkgs/development/python-modules/untokenize/default.nix +++ b/pkgs/development/python-modules/untokenize/default.nix @@ -1,7 +1,7 @@ { lib , buildPythonPackage , fetchPypi -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -13,7 +13,7 @@ buildPythonPackage rec { sha256 = "3865dbbbb8efb4bb5eaa72f1be7f3e0be00ea8b7f125c69cbd1f5fda926f37a2"; }; - checkPhase = "${python.interpreter} -m unittest discover"; + checkInputs = [ unittestCheckHook ]; meta = with lib; { description = "Transforms tokens into original source code while preserving whitespace"; diff --git a/pkgs/development/python-modules/vapoursynth/default.nix b/pkgs/development/python-modules/vapoursynth/default.nix index bfd5e1ca8b2..ec88f244aee 100644 --- a/pkgs/development/python-modules/vapoursynth/default.nix +++ b/pkgs/development/python-modules/vapoursynth/default.nix @@ -1,4 +1,4 @@ -{ vapoursynth, cython, buildPythonPackage, python }: +{ vapoursynth, cython, buildPythonPackage, unittestCheckHook }: buildPythonPackage { pname = "vapoursynth"; @@ -13,9 +13,11 @@ buildPythonPackage { vapoursynth ]; - checkPhase = '' - ${python.interpreter} -m unittest discover -s $src/test -p "*test.py" - ''; + checkInputs = [ + unittestCheckHook + ]; + + unittestFlagsArray = [ "-s" "$src/test" "-p" "'*test.py'" ]; inherit (vapoursynth) meta; } diff --git a/pkgs/development/python-modules/webcolors/default.nix b/pkgs/development/python-modules/webcolors/default.nix index ccd4163492f..46498b5950a 100644 --- a/pkgs/development/python-modules/webcolors/default.nix +++ b/pkgs/development/python-modules/webcolors/default.nix @@ -2,7 +2,7 @@ , buildPythonPackage , fetchPypi , pythonOlder -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -17,9 +17,9 @@ buildPythonPackage rec { hash = "sha256-FtBD06CP1qGxt+Pp5iZA0JeQ3OgNK91HkqF1s1/nlKk="; }; - checkPhase = '' - ${python.interpreter} -m unittest discover -s tests - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" "tests" ]; pythonImportsCheck = [ "webcolors" diff --git a/pkgs/development/python-modules/websockets/default.nix b/pkgs/development/python-modules/websockets/default.nix index 538055b9890..ba8ee074664 100644 --- a/pkgs/development/python-modules/websockets/default.nix +++ b/pkgs/development/python-modules/websockets/default.nix @@ -2,7 +2,7 @@ , stdenv , buildPythonPackage , fetchFromGitHub -, python +, unittestCheckHook , pythonOlder }: @@ -44,11 +44,7 @@ buildPythonPackage rec { done ''; - checkPhase = '' - runHook preCheck - ${python.interpreter} -m unittest discover - runHook postCheck - ''; + checkInputs = [ unittestCheckHook ]; pythonImportsCheck = [ "websockets" diff --git a/pkgs/development/python-modules/zake/default.nix b/pkgs/development/python-modules/zake/default.nix index 89635a88f35..f144bc9d2c4 100644 --- a/pkgs/development/python-modules/zake/default.nix +++ b/pkgs/development/python-modules/zake/default.nix @@ -4,7 +4,7 @@ , kazoo , six , testtools -, python +, unittestCheckHook }: buildPythonPackage rec { @@ -18,14 +18,15 @@ buildPythonPackage rec { propagatedBuildInputs = [ kazoo six ]; buildInputs = [ testtools ]; - checkPhase = '' + checkInputs = [ unittestCheckHook ]; + preCheck = '' # Skip test - fails with our new kazoo version substituteInPlace zake/tests/test_client.py \ --replace "test_child_watch_no_create" "_test_child_watch_no_create" - - ${python.interpreter} -m unittest discover zake/tests ''; + unittestFlagsArray = [ "zake/tests" ]; + meta = with lib; { homepage = "https://github.com/yahoo/Zake"; description = "A python package that works to provide a nice set of testing utilities for the kazoo library"; diff --git a/pkgs/development/python-modules/zope_copy/default.nix b/pkgs/development/python-modules/zope_copy/default.nix index 0d1ae412262..be4cdca72b6 100644 --- a/pkgs/development/python-modules/zope_copy/default.nix +++ b/pkgs/development/python-modules/zope_copy/default.nix @@ -5,6 +5,7 @@ , zope_interface , zope_location , zope_schema +, unittestCheckHook }: @@ -20,11 +21,9 @@ buildPythonPackage rec { propagatedBuildInputs = [ zope_interface ]; doCheck = !isPy27; # namespace conflicts - checkInputs = [ zope_location zope_schema ]; + checkInputs = [ unittestCheckHook zope_location zope_schema ]; - checkPhase = '' - python -m unittest discover -s src/zope/copy - ''; + unittestFlagsArray = [ "-s" "src/zope/copy" ]; meta = { maintainers = with lib.maintainers; [ domenkozar ]; diff --git a/pkgs/development/python2-modules/mock/default.nix b/pkgs/development/python2-modules/mock/default.nix index 190297b41a2..f30c407e6f5 100644 --- a/pkgs/development/python2-modules/mock/default.nix +++ b/pkgs/development/python2-modules/mock/default.nix @@ -5,7 +5,7 @@ , funcsigs , six , pbr -, python +, unittestCheckHook , pytest }: @@ -27,11 +27,8 @@ buildPythonPackage rec { #doCheck = !(python.isPyPy && python.isPy27); doCheck = false; # Infinite recursion pytest - checkPhase = '' - ${python.interpreter} -m unittest discover - ''; - checkInputs = [ + unittestCheckHook pytest ]; diff --git a/pkgs/development/python2-modules/typing/default.nix b/pkgs/development/python2-modules/typing/default.nix index b3dcea20323..a835be985ff 100644 --- a/pkgs/development/python2-modules/typing/default.nix +++ b/pkgs/development/python2-modules/typing/default.nix @@ -1,4 +1,4 @@ -{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, python +{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, unittestCheckHook , pythonAtLeast }: let @@ -20,10 +20,9 @@ in buildPythonPackage rec { # Also, don't bother on PyPy: AssertionError: TypeError not raised doCheck = pythonOlder "3.6" && !isPyPy; - checkPhase = '' - cd ${testDir} - ${python.interpreter} -m unittest discover - ''; + checkInputs = [ unittestCheckHook ]; + + unittestFlagsArray = [ "-s" testDir ]; meta = with lib; { description = "Backport of typing module to Python versions older than 3.5"; diff --git a/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix b/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix index e38466df6e6..437856c0350 100644 --- a/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix +++ b/pkgs/servers/monitoring/prometheus/xmpp-alerts.nix @@ -2,6 +2,7 @@ , fetchFromGitHub , python3Packages , prometheus-alertmanager +, unittestCheckHook }: python3Packages.buildPythonApplication rec { @@ -25,13 +26,10 @@ python3Packages.buildPythonApplication rec { ]); checkInputs = with python3Packages; [ + unittestCheckHook pytz ]; - checkPhase = '' - ${python3Packages.python.interpreter} -m unittest discover - ''; - meta = { description = "XMPP Web hook for Prometheus"; homepage = "https://github.com/jelmer/prometheus-xmpp-alerts"; diff --git a/pkgs/tools/networking/wifite2/default.nix b/pkgs/tools/networking/wifite2/default.nix index 98ca976fd3e..cfae235f4cb 100644 --- a/pkgs/tools/networking/wifite2/default.nix +++ b/pkgs/tools/networking/wifite2/default.nix @@ -42,8 +42,7 @@ python3.pkgs.buildPythonApplication rec { pixiewps ]; - checkInputs = propagatedBuildInputs; - checkPhase = "python -m unittest discover tests -v"; + checkInputs = propagatedBuildInputs ++ [ python3.pkgs.unittestCheckHook ]; meta = with lib; { homepage = "https://github.com/kimocoder/wifite2";