1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-01 13:29:13 +03:00

treewide: migrate to pythonPackages.unittestCheckHook

This commit is contained in:
Winter 2022-08-06 12:32:04 -04:00
parent e8fbb38a51
commit 19adc3341c
82 changed files with 278 additions and 417 deletions

View file

@ -37,6 +37,7 @@ in python3.pkgs.buildPythonApplication rec {
nativeBuildInputs = with python3.pkgs; [ nativeBuildInputs = with python3.pkgs; [
setuptools-scm setuptools-scm
docutils docutils
setuptoolsCheckHook
]; ];
propagatedBuildInputs = with python3.pkgs; [ propagatedBuildInputs = with python3.pkgs; [
@ -64,14 +65,12 @@ in python3.pkgs.buildPythonApplication rec {
export SETUPTOOLS_SCM_PRETEND_VERSION="${version}" export SETUPTOOLS_SCM_PRETEND_VERSION="${version}"
''; '';
checkPhase = '' preCheck = ''
runHook preCheck
# disable tests that require internet access # disable tests that require internet access
# https://github.com/JoeLametta/whipper/issues/291 # https://github.com/JoeLametta/whipper/issues/291
substituteInPlace whipper/test/test_common_accurip.py \ substituteInPlace whipper/test/test_common_accurip.py \
--replace "test_AccurateRipResponse" "dont_test_AccurateRipResponse" --replace "test_AccurateRipResponse" "dont_test_AccurateRipResponse"
HOME=$TMPDIR ${python3.interpreter} -m unittest discover export HOME=$TMPDIR
runHook postCheck
''; '';
passthru.tests.version = testers.testVersion { passthru.tests.version = testers.testVersion {

View file

@ -52,11 +52,9 @@ buildPythonApplication rec {
# will fail without pre-seeded config files # will fail without pre-seeded config files
doCheck = false; doCheck = false;
checkInputs = [ mock ]; checkInputs = [ unittestCheckHook mock ];
checkPhase = '' unittestFlagsArray = [ "-s" "tests" "-v" ];
${python.interpreter} -m unittest discover -s tests -v
'';
meta = with lib; { meta = with lib; {
homepage = "https://github.com/donnemartin/haxor-news"; homepage = "https://github.com/donnemartin/haxor-news";

View file

@ -15,9 +15,7 @@ in buildPythonApplication rec {
nativeBuildInputs = [ setuptools-scm ]; nativeBuildInputs = [ setuptools-scm ];
propagatedBuildInputs = [ pyyaml six jinja2 cerberus_1_1 ]; propagatedBuildInputs = [ pyyaml six jinja2 cerberus_1_1 ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
homepage = "https://pythonhosted.org/pyditz/"; homepage = "https://pythonhosted.org/pyditz/";

View file

@ -1,4 +1,4 @@
{ lib, python3Packages, fetchFromGitHub, glibcLocales }: { lib, python3Packages, fetchFromGitHub, glibcLocales, unittestCheckHook }:
with python3Packages; with python3Packages;
@ -22,13 +22,12 @@ buildPythonApplication rec {
watchdog watchdog
]; ];
checkInputs = [ mock freezegun pylint ]; checkInputs = [ unittestCheckHook mock freezegun pylint ];
# Skip test that has been reported multiple times upstream without result: # Skip test that has been reported multiple times upstream without result:
# bram85/topydo#271, bram85/topydo#274. # bram85/topydo#271, bram85/topydo#274.
checkPhase = '' preCheck = ''
substituteInPlace test/test_revert_command.py --replace 'test_revert_ls' 'dont_test_revert_ls' 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";

View file

@ -12,7 +12,7 @@
, typing-extensions , typing-extensions
# tests # tests
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -35,14 +35,14 @@ buildPythonPackage rec {
typing-extensions typing-extensions
]; ];
checkInputs = [
unittestCheckHook
];
pythonImportsCheck = [ pythonImportsCheck = [
"aioitertools" "aioitertools"
]; ];
checkPhase = ''
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
description = "Implementation of itertools, builtins, and more for AsyncIO and mixed-type iterables"; description = "Implementation of itertools, builtins, and more for AsyncIO and mixed-type iterables";
license = licenses.mit; license = licenses.mit;

View file

@ -1,5 +1,8 @@
{ buildPythonPackage, python, lib, fetchFromGitHub { buildPythonPackage
, lib
, fetchFromGitHub
, mock , mock
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -14,9 +17,8 @@ buildPythonPackage rec {
sha256 = "1kp2iyx20lpc9dv4qg5fgwf83a1wx6f7hj1ldqyncg0kn9xcrhbg"; sha256 = "1kp2iyx20lpc9dv4qg5fgwf83a1wx6f7hj1ldqyncg0kn9xcrhbg";
}; };
checkInputs = [ mock ]; checkInputs = [ unittestCheckHook mock ];
unittestFlagsArray = [ "-s" "tests" ];
checkPhase = "${python.interpreter} -m unittest discover -s tests";
meta = with lib; { meta = with lib; {
description = "Get a BibTeX entry from an arXiv id number, using the arxiv.org API"; description = "Get a BibTeX entry from an arXiv id number, using the arxiv.org API";

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, unidecode, regex, python }: { lib, buildPythonPackage, fetchPypi, unidecode, regex, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "awesome-slugify"; pname = "awesome-slugify";
@ -20,9 +20,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ unidecode regex ]; propagatedBuildInputs = [ unidecode regex ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
homepage = "https://github.com/dimka665/awesome-slugify"; homepage = "https://github.com/dimka665/awesome-slugify";

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -13,9 +13,7 @@ buildPythonPackage rec {
sha256 = "033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde"; sha256 = "033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = { meta = {
homepage = "https://github.com/cython/backports_abc"; homepage = "https://github.com/cython/backports_abc";

View file

@ -1,5 +1,5 @@
{ lib { lib
, python , unittestCheckHook
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, setuptools-scm , setuptools-scm
@ -19,13 +19,13 @@ buildPythonPackage rec {
propagatedBuildInputs = [ backports_weakref ]; propagatedBuildInputs = [ backports_weakref ];
checkPhase = ''
${python.interpreter} -m unittest discover -s tests
'';
# requires https://pypi.org/project/backports.test.support # requires https://pypi.org/project/backports.test.support
doCheck = false; doCheck = false;
checkInputs = [ unittestCheckHook ];
unittestFlagsArray = [ "-s" "tests" ];
meta = { meta = {
description = "Backport of new features in Python's tempfile module"; description = "Backport of new features in Python's tempfile module";
license = lib.licenses.psfl; license = lib.licenses.psfl;

View file

@ -3,7 +3,7 @@
, fetchPypi , fetchPypi
, setuptools-scm , setuptools-scm
# , backports # , backports
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -20,9 +20,9 @@ buildPythonPackage rec {
# Requires backports package # Requires backports package
doCheck = false; doCheck = false;
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover tests
''; unittestFlagsArray = [ "tests" ];
meta = with lib; { meta = with lib; {
description = "Backports of new features in Pythons weakref module"; description = "Backports of new features in Pythons weakref module";

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -15,10 +15,9 @@ buildPythonPackage rec {
sha256 = "0y2kcq58psvl038r6dhahhlhp1wjgr5zsms45wyz1naq6ri8x9qa"; sha256 = "0y2kcq58psvl038r6dhahhlhp1wjgr5zsms45wyz1naq6ri8x9qa";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
cd test
${python.interpreter} -m unittest discover unittestFlagsArray = [ "-s" "test" ];
'';
pythonImportsCheck = [ "bitstring" ]; pythonImportsCheck = [ "bitstring" ];

View file

@ -9,6 +9,7 @@
, regex , regex
, tabview , tabview
, python , python
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -33,19 +34,22 @@ buildPythonPackage rec {
tabview tabview
]; ];
checkInputs = [ unittestCheckHook ];
pythonImportsCheck = [ pythonImportsCheck = [
"clevercsv" "clevercsv"
"clevercsv.cparser" "clevercsv.cparser"
]; ];
checkPhase = '' preCheck = ''
# by linking the installed version the tests also have access to compiled native libraries # by linking the installed version the tests also have access to compiled native libraries
rm -r clevercsv rm -r clevercsv
ln -s $out/${python.sitePackages}/clevercsv/ 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; { meta = with lib; {
description = "CleverCSV is a Python package for handling messy CSV files"; description = "CleverCSV is a Python package for handling messy CSV files";
longDescription = '' longDescription = ''

View file

@ -3,6 +3,7 @@
, fetchPypi , fetchPypi
, python , python
, pythonOlder , pythonOlder
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -17,11 +18,7 @@ buildPythonPackage rec {
hash = "sha256-qx4r/h0B2Wjht+jZAjvFHvNQm7ohe7cwzuOCfh7oKGk="; hash = "sha256-qx4r/h0B2Wjht+jZAjvFHvNQm7ohe7cwzuOCfh7oKGk=";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"contextlib2" "contextlib2"

View file

@ -3,8 +3,10 @@
, fetchPypi , fetchPypi
, isPyPy , isPyPy
, python , python
, blas, lapack # build segfaults with 64-bit blas , blas
, lapack # build segfaults with 64-bit blas
, suitesparse , suitesparse
, unittestCheckHook
, glpk ? null , glpk ? null
, gsl ? null , gsl ? null
, fftw ? null , fftw ? null
@ -49,9 +51,9 @@ buildPythonPackage rec {
export CVXOPT_FFTW_INC_DIR=${fftw.dev}/include export CVXOPT_FFTW_INC_DIR=${fftw.dev}/include
''; '';
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s tests
''; unittestFlagsArray = [ "-s" "tests" ];
meta = with lib; { meta = with lib; {
homepage = "http://cvxopt.org/"; homepage = "http://cvxopt.org/";

View file

@ -14,6 +14,7 @@
, toml , toml
, types-setuptools , types-setuptools
, types-toml , types-toml
, unittestCheckHook
, xmldiff , xmldiff
}: }:
@ -47,6 +48,7 @@ buildPythonPackage rec {
]; ];
checkInputs = [ checkInputs = [
unittestCheckHook
jsonschema jsonschema
lxml lxml
xmldiff xmldiff
@ -56,12 +58,8 @@ buildPythonPackage rec {
"cyclonedx" "cyclonedx"
]; ];
checkPhase = '' preCheck = ''
runHook preCheck
# Tests require network access
rm tests/test_output_json.py rm tests/test_output_json.py
${python.interpreter} -m unittest discover -s tests -v
runHook postCheck
''; '';
meta = with lib; { meta = with lib; {

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, cython , cython
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -25,10 +25,9 @@ buildPythonPackage rec {
--replace "wheel>=0.32.0,<0.33.0" "wheel>=0.31.0" --replace "wheel>=0.32.0,<0.33.0" "wheel>=0.31.0"
''; '';
checkPhase = '' checkInputs = [ unittestCheckHook ];
cd cymem/tests
${python.interpreter} -m unittest discover -p "*test*" unittestFlagsArray = [ "-s" "cymem/tests" "-p" "*test*" ];
'';
meta = with lib; { meta = with lib; {
description = "Cython memory pool for RAII-style memory management"; description = "Cython memory pool for RAII-style memory management";

View file

@ -5,6 +5,7 @@
, pythonAtLeast , pythonAtLeast
, pythonOlder , pythonOlder
, unittest2 , unittest2
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -29,14 +30,10 @@ buildPythonPackage rec {
# avoiding mass rebuilds for python3.9, but no longer # avoiding mass rebuilds for python3.9, but no longer
# needed with patch # needed with patch
checkInputs = lib.optional (pythonOlder "3.10") [ checkInputs = [ unittestCheckHook ] ++ lib.optional (pythonOlder "3.10") [
unittest2 unittest2
]; ];
checkPhase = ''
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
description = "A library to handle automated deprecations"; description = "A library to handle automated deprecations";
homepage = "https://deprecation.readthedocs.io/"; homepage = "https://deprecation.readthedocs.io/";

View file

@ -1,5 +1,5 @@
{ lib, fetchFromGitHub, buildPythonPackage { lib, fetchFromGitHub, buildPythonPackage
, python, isPy3k }: , python, isPy3k, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "emailthreads"; pname = "emailthreads";
@ -14,11 +14,9 @@ buildPythonPackage rec {
sha256 = "sha256-7BhYS1DQCW9QpG31asPCq5qPyJy+WW2onZpvEHhwQCs="; sha256 = "sha256-7BhYS1DQCW9QpG31asPCq5qPyJy+WW2onZpvEHhwQCs=";
}; };
PKGVER = version; checkInputs = [ unittestCheckHook ];
checkPhase = '' PKGVER = version;
${python.interpreter} -m unittest discover test
'';
meta = with lib; { meta = with lib; {
homepage = "https://github.com/emersion/python-emailthreads"; homepage = "https://github.com/emersion/python-emailthreads";

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, pythonAtLeast , pythonAtLeast
, python , unittestCheckHook
}: }:
if pythonAtLeast "3.4" then null else buildPythonPackage rec { if pythonAtLeast "3.4" then null else buildPythonPackage rec {
@ -14,9 +14,7 @@ if pythonAtLeast "3.4" then null else buildPythonPackage rec {
sha256 = "cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248"; sha256 = "cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
homepage = "https://pypi.python.org/pypi/enum34"; homepage = "https://pypi.python.org/pypi/enum34";

View file

@ -2,7 +2,7 @@
, pythonOlder , pythonOlder
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -16,9 +16,7 @@ buildPythonPackage rec {
sha256 = "6ac99dda4e7b0b3ae831507b6d0094802e6dd95891feafde8cc5c405b6c149ca"; sha256 = "6ac99dda4e7b0b3ae831507b6d0094802e6dd95891feafde8cc5c405b6c149ca";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
pythonImportsCheck = [ "fastimport" ]; pythonImportsCheck = [ "fastimport" ];

View file

@ -5,6 +5,7 @@
, cryptography , cryptography
, mock , mock
, pyfakefs , pyfakefs
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -18,17 +19,9 @@ buildPythonPackage rec {
propagatedBuildInputs = [ six cryptography ]; propagatedBuildInputs = [ six cryptography ];
checkInputs = [ mock pyfakefs ]; checkInputs = [ unittestCheckHook mock pyfakefs ];
# Testing with `python setup.py test` doesn't work: unittestFlagsArray = [ "-v" ];
# https://github.com/Yubico/python-fido2/issues/108#issuecomment-763513576
checkPhase = ''
runHook preCheck
python -m unittest discover -v
runHook postCheck
'';
pythonImportsCheck = [ "fido2" ]; pythonImportsCheck = [ "fido2" ];

View file

@ -1,6 +1,6 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, python , unittestCheckHook
, fetchPypi , fetchPypi
, flask , flask
, babel , babel
@ -26,9 +26,7 @@ buildPythonPackage rec {
speaklater speaklater
]; ];
checkPhase = '' unittestFlagsArray = [ "-s" "tests" ];
${python.interpreter} -m unittest discover -s tests
'';
meta = with lib; { meta = with lib; {
description = "Adds i18n/l10n support to Flask applications"; description = "Adds i18n/l10n support to Flask applications";

View file

@ -3,7 +3,7 @@
, fetchFromGitHub , fetchFromGitHub
, flask , flask
, bcrypt , bcrypt
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -22,11 +22,7 @@ buildPythonPackage rec {
bcrypt bcrypt
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"flask_bcrypt" "flask_bcrypt"

View file

@ -6,7 +6,7 @@
, flask , flask
, flask_script , flask_script
, flask-sqlalchemy , flask-sqlalchemy
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -33,15 +33,10 @@ buildPythonPackage rec {
]; ];
checkInputs = [ checkInputs = [
unittestCheckHook
flask_script flask_script
]; ];
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
meta = with lib; { meta = with lib; {
description = "SQLAlchemy database migrations for Flask applications using Alembic"; description = "SQLAlchemy database migrations for Flask applications using Alembic";
homepage = "https://github.com/miguelgrinberg/Flask-Migrate"; homepage = "https://github.com/miguelgrinberg/Flask-Migrate";

View file

@ -1,4 +1,4 @@
{ lib, fetchFromGitHub, buildPythonPackage, isPy3k, flask, mock, python }: { lib, fetchFromGitHub, buildPythonPackage, isPy3k, flask, mock, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "Flask-SeaSurf"; pname = "Flask-SeaSurf";
@ -15,15 +15,10 @@ buildPythonPackage rec {
propagatedBuildInputs = [ flask ]; propagatedBuildInputs = [ flask ];
checkInputs = [ checkInputs = [
unittestCheckHook
mock mock
]; ];
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ "flask_seasurf" ]; pythonImportsCheck = [ "flask_seasurf" ];
meta = with lib; { meta = with lib; {

View file

@ -4,6 +4,7 @@
, buildPythonPackage , buildPythonPackage
, rustPlatform , rustPlatform
, setuptools-rust , setuptools-rust
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -31,9 +32,7 @@ buildPythonPackage rec {
rust.rustc rust.rustc
]); ]);
checkPhase = '' checkInputs = [ unittestCheckHook ];
python -m unittest discover
'';
pythonImportsCheck = [ "gb_io" ]; pythonImportsCheck = [ "gb_io" ];

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPyPy , isPyPy
, python , unittestCheckHook
}: }:
@ -16,11 +16,9 @@ buildPythonPackage rec {
sha256 = "e30f5ea4ae2346e62cedde8794a56858a67b878dd79f7df76a0767e356b1744a"; sha256 = "e30f5ea4ae2346e62cedde8794a56858a67b878dd79f7df76a0767e356b1744a";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover -v greenlet.tests unittestFlagsArray = [ "-v" "greenlet.tests" ];
runHook postCheck
'';
meta = with lib; { meta = with lib; {
homepage = "https://github.com/python-greenlet/greenlet"; homepage = "https://github.com/python-greenlet/greenlet";

View file

@ -4,6 +4,7 @@
, espeak , espeak
, numpy , numpy
, python , python
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -29,11 +30,7 @@ buildPythonPackage rec {
numpy numpy
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"gruut_ipa" "gruut_ipa"

View file

@ -6,7 +6,7 @@
, importlib-metadata , importlib-metadata
, typing ? null , typing ? null
, pythonOlder , pythonOlder
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -31,9 +31,9 @@ buildPythonPackage rec {
typing typing
]; ];
checkPhase = '' checkInputs = [
${python.interpreter} -m unittest discover unittestCheckHook
''; ];
pythonImportsCheck = [ pythonImportsCheck = [
"importlib_resources" "importlib_resources"

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
, six , six
}: }:
@ -16,9 +16,9 @@ buildPythonPackage rec {
propagatedBuildInputs = [ six ]; propagatedBuildInputs = [ six ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s src/isodate/tests
''; unittestFlagsArray = [ "-s" "src/isodate/tests" ];
meta = with lib; { meta = with lib; {
description = "ISO 8601 date/time parser"; description = "ISO 8601 date/time parser";

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, lxml , lxml
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -22,11 +22,9 @@ buildPythonPackage rec {
# https://github.com/Juniper/jxmlease/issues/26 # https://github.com/Juniper/jxmlease/issues/26
doCheck = false; doCheck = false;
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover -v unittestFlagsArray = [ "-v" ];
runHook postCheck
'';
meta = with lib; { meta = with lib; {
description = "Converts between XML and intelligent Python data structures"; description = "Converts between XML and intelligent Python data structures";

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, karton-core , karton-core
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -20,11 +20,7 @@ buildPythonPackage rec {
karton-core karton-core
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ "karton.asciimagic" ]; pythonImportsCheck = [ "karton.asciimagic" ];

View file

@ -2,7 +2,7 @@
, boto3 , boto3
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
, redis , redis
}: }:
@ -22,11 +22,7 @@ buildPythonPackage rec {
redis redis
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"karton.core" "karton.core"

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, karton-core , karton-core
, python , unittestCheckHook
, yara-python , yara-python
}: }:
@ -22,11 +22,7 @@ buildPythonPackage rec {
yara-python yara-python
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ "karton.yaramatcher" ]; pythonImportsCheck = [ "karton.yaramatcher" ];

View file

@ -12,7 +12,7 @@
# tests # tests
, responses , responses
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -44,15 +44,10 @@ buildPythonPackage rec {
doCheck = false; doCheck = false;
checkInputs = [ checkInputs = [
unittestCheckHook
responses responses
]; ];
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"kbcstorage" "kbcstorage"
"kbcstorage.buckets" "kbcstorage.buckets"

View file

@ -4,7 +4,7 @@
, fetchPypi , fetchPypi
, importlib-metadata , importlib-metadata
, pyyaml , pyyaml
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -25,11 +25,7 @@ buildPythonPackage rec {
importlib-metadata importlib-metadata
]; ];
checkInputs = [ pyyaml ]; checkInputs = [ unittestCheckHook pyyaml ];
checkPhase = ''
${python.interpreter} -m unittest discover
'';
pythonImportsCheck = [ "markdown" ]; pythonImportsCheck = [ "markdown" ];

View file

@ -1,7 +1,7 @@
{ lib { lib
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, python , unittestCheckHook
, pythonOlder , pythonOlder
, fetchFromGitLab , fetchFromGitLab
, substituteAll , substituteAll
@ -17,7 +17,8 @@
, mutagen , mutagen
, pygobject3 , pygobject3
, pycairo , pycairo
, dolphinIntegration ? false, plasma5Packages , dolphinIntegration ? false
, plasma5Packages
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -92,9 +93,9 @@ buildPythonPackage rec {
install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus" install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus"
''; '';
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -v
''; unittestFlagsArray = [ "-v" ];
meta = with lib; { meta = with lib; {
description = "A handy tool to trash your metadata"; description = "A handy tool to trash your metadata";

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, pythonOlder , pythonOlder
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -22,17 +22,13 @@ buildPythonPackage rec {
substituteInPlace setup.py --replace "license=license" "license='MIT'" substituteInPlace setup.py --replace "license=license" "license='MIT'"
''; '';
checkInputs = [ unittestCheckHook ];
pythonImportsCheck = [ pythonImportsCheck = [
"maxcube" "maxcube"
"maxcube.cube" "maxcube.cube"
]; ];
checkPhase = ''
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
meta = with lib; { meta = with lib; {
description = "eQ-3/ELV MAX! Cube Python API"; description = "eQ-3/ELV MAX! Cube Python API";
homepage = "https://github.com/hackercowboy/python-maxcube-api"; homepage = "https://github.com/hackercowboy/python-maxcube-api";

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -15,11 +15,7 @@ buildPythonPackage rec {
sha256 = "sha256-regIrMWbGmW574dfojxZFJoivpaqOpN1I6YsqLEp8BM="; sha256 = "sha256-regIrMWbGmW574dfojxZFJoivpaqOpN1I6YsqLEp8BM=";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
meta = with lib; { meta = with lib; {
description = "Set of basic tools that can help to create Markdown files"; description = "Set of basic tools that can help to create Markdown files";

View file

@ -18,7 +18,7 @@
# testing deps # testing deps
, babel , babel
, mock , mock
, pytestCheckHook , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -47,20 +47,12 @@ buildPythonPackage rec {
]; ];
checkInputs = [ checkInputs = [
unittestCheckHook
babel babel
mock mock
]; ];
unittestFlagsArray = [ "-v" "-p" "'*tests.py'" "mkdocs" ];
checkPhase = ''
set -euo pipefail
runHook preCheck
python -m unittest discover -v -p '*tests.py' mkdocs --top-level-directory .
runHook postCheck
'';
pythonImportsCheck = [ "mkdocs" ]; pythonImportsCheck = [ "mkdocs" ];

View file

@ -5,6 +5,7 @@
, python , python
, pythonOlder , pythonOlder
, pytest , pytest
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -26,11 +27,8 @@ buildPythonPackage rec {
}) })
]; ];
checkPhase = ''
${python.interpreter} -m unittest discover
'';
checkInputs = [ checkInputs = [
unittestCheckHook
pytest pytest
]; ];

View file

@ -6,7 +6,7 @@
, fetchFromGitHub , fetchFromGitHub
, humanize , humanize
, keyring , keyring
, python , unittestCheckHook
, python-dateutil , python-dateutil
, pythonOlder , pythonOlder
, requests , requests
@ -36,11 +36,7 @@ buildPythonPackage rec {
requests requests
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"mwdblib" "mwdblib"

View file

@ -2,7 +2,7 @@
, fetchFromGitHub , fetchFromGitHub
, buildPythonPackage , buildPythonPackage
, typing , typing
, python , unittestCheckHook
, pythonOlder , pythonOlder
}: }:
@ -19,9 +19,9 @@ buildPythonPackage rec {
propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing; propagatedBuildInputs = lib.optional (pythonOlder "3.5") typing;
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover tests
''; unittestFlagsArray = [ "tests" ];
pythonImportsCheck = [ "mypy_extensions" ]; pythonImportsCheck = [ "mypy_extensions" ];

View file

@ -4,6 +4,7 @@
, git , git
, which , which
, pythonOlder , pythonOlder
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -19,11 +20,8 @@ buildPythonPackage rec {
sha256 = "GHUH3Oog800qrdgXs5AEa4O6ovZ1LT0k3P4YwEHfwlY="; sha256 = "GHUH3Oog800qrdgXs5AEa4O6ovZ1LT0k3P4YwEHfwlY=";
}; };
checkInputs = [ git which ]; checkInputs = [ unittestCheckHook git which ];
checkPhase = ''
python -m unittest discover
'';
# ignore tests which are impure # ignore tests which are impure
DISABLED_TESTS = "network requires_nix_build"; DISABLED_TESTS = "network requires_nix_build";

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
, pythonAtLeast , pythonAtLeast
}: }:
@ -15,9 +15,7 @@ buildPythonPackage rec {
sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39"; sha256 = "17zajiw4mjbkkv6ahp3xf025qglkj0805m9s41c45zryzj6p2h39";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = { meta = {
description = "Object-oriented filesystem paths"; description = "Object-oriented filesystem paths";

View file

@ -2,7 +2,9 @@
, python , python
, fetchPypi , fetchPypi
, buildPythonPackage , buildPythonPackage
, postgresql }: , postgresql
, unittestCheckHook
}:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pgsanity"; pname = "pgsanity";
@ -13,11 +15,7 @@ buildPythonPackage rec {
sha256 = "de0bbd6fe4f98bf5139cb5f466eac2e2abaf5a7b050b9e4867b87bf360873173"; sha256 = "de0bbd6fe4f98bf5139cb5f466eac2e2abaf5a7b050b9e4867b87bf360873173";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook postgresql ];
${python.interpreter} -m unittest discover -s test
'';
checkInputs = [ postgresql ];
propagatedBuildInputs = [ postgresql ]; propagatedBuildInputs = [ postgresql ];
meta = with lib; { meta = with lib; {

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
, pythonOlder , pythonOlder
}: }:
@ -17,10 +17,9 @@ buildPythonPackage rec {
hash = "sha256-OL3YZNBFD7dIGTqoF7nEWKj1MZ+/l7ImEVHPwKWBIJA="; hash = "sha256-OL3YZNBFD7dIGTqoF7nEWKj1MZ+/l7ImEVHPwKWBIJA=";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
cd doc
${python.interpreter} -m unittest discover -p "*test_plac*" unittestFlagsArray = [ "-s" "doc" "-p" "*test_plac*" ];
'';
pythonImportsCheck = [ pythonImportsCheck = [
"plac" "plac"

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, libpulseaudio, glibc, substituteAll, stdenv, pulseaudio, python }: { lib, buildPythonPackage, fetchPypi, libpulseaudio, glibc, substituteAll, stdenv, pulseaudio, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pulsectl"; pname = "pulsectl";
@ -22,11 +22,10 @@ buildPythonPackage rec {
"pulsectl" "pulsectl"
]; ];
checkInputs = [ pulseaudio ]; checkInputs = [ unittestCheckHook pulseaudio ];
checkPhase = '' preCheck = ''
export HOME=$TMPDIR export HOME=$TMPDIR
${python.interpreter} -m unittest discover
''; '';
meta = with lib; { meta = with lib; {

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, python }: { lib, buildPythonPackage, fetchPypi, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pycparser"; pname = "pycparser";
@ -9,9 +9,9 @@ buildPythonPackage rec {
sha256 = "e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206"; sha256 = "e644fdec12f7872f86c58ff790da456218b10f863970249516d60a5eaca77206";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s tests
''; unittestFlagsArray = [ "-s" "tests" ];
meta = with lib; { meta = with lib; {
description = "C parser in Python"; description = "C parser in Python";

View file

@ -4,7 +4,7 @@
, pythonOlder , pythonOlder
, glibcLocales , glibcLocales
, typing-extensions , typing-extensions
, python , unittestCheckHook
, isPy3k , isPy3k
}: }:
@ -24,13 +24,11 @@ buildPythonPackage rec {
typing-extensions typing-extensions
]; ];
checkPhase = ''
${python.interpreter} -m unittest discover
'';
# Tests broken on Python 3.x # Tests broken on Python 3.x
#doCheck = !(isPy3k); #doCheck = !(isPy3k);
checkInputs = [ unittestCheckHook ];
meta = with lib; { meta = with lib; {
description = "A Pure-Python library built as a PDF toolkit"; description = "A Pure-Python library built as a PDF toolkit";
homepage = "http://mstamy2.github.com/PyPDF2/"; homepage = "http://mstamy2.github.com/PyPDF2/";

View file

@ -5,7 +5,7 @@
, poetry-core , poetry-core
, netaddr , netaddr
, six , six
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -43,11 +43,9 @@ buildPythonPackage rec {
--replace "def testBindv6(self):" "def dontTestBindv6(self):" --replace "def testBindv6(self):" "def dontTestBindv6(self):"
''; '';
checkPhase = '' checkInputs = [
runHook preCheck unittestCheckHook
${python.interpreter} -m unittest discover ];
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"pyrad" "pyrad"

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, python, fetchFromGitHub, lm_sensors }: { lib, buildPythonPackage, unittestCheckHook, fetchFromGitHub, lm_sensors }:
buildPythonPackage { buildPythonPackage {
version = "2017-07-13"; version = "2017-07-13";
pname = "pysensors"; pname = "pysensors";
@ -17,10 +17,9 @@ buildPythonPackage {
# due to sandboxing # due to sandboxing
doCheck = false; doCheck = false;
checkPhase = '' checkInputs = [ unittestCheckHook ];
cd tests
${python.interpreter} -m unittest discover unittestFlagsArray = [ "-s" "tests" ];
'';
meta = with lib; { meta = with lib; {
maintainers = with maintainers; [ guibou ]; maintainers = with maintainers; [ guibou ];

View file

@ -2,7 +2,7 @@
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
, pythonOlder , pythonOlder
, isPy3k , isPy3k
}: }:
@ -27,11 +27,9 @@ buildPythonPackage rec {
doCheck = !stdenv.hostPlatform.isDarwin; # broken on darwin doCheck = !stdenv.hostPlatform.isDarwin; # broken on darwin
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover -s test unittestFlagsArray = [ "-s" "test" ];
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"serial" "serial"

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, python, fetchPypi, isPy3k, glibcLocales }: { lib, buildPythonPackage, unittestCheckHook, fetchPypi, isPy3k, glibcLocales }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pystache"; pname = "pystache";
@ -13,14 +13,12 @@ buildPythonPackage rec {
buildInputs = [ glibcLocales ]; buildInputs = [ glibcLocales ];
checkPhase = ''
${python.interpreter} -m unittest discover
'';
# SyntaxError Python 3 # SyntaxError Python 3
# https://github.com/defunkt/pystache/issues/181 # https://github.com/defunkt/pystache/issues/181
doCheck = !isPy3k; doCheck = !isPy3k;
checkInputs = [ unittestCheckHook ];
meta = with lib; { meta = with lib; {
description = "A framework-agnostic, logic-free templating system inspired by ctemplate and et"; description = "A framework-agnostic, logic-free templating system inspired by ctemplate and et";
homepage = "https://github.com/defunkt/pystache"; homepage = "https://github.com/defunkt/pystache";

View file

@ -4,6 +4,7 @@
, requests , requests
, python-jose , python-jose
, httmock , httmock
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -23,13 +24,10 @@ buildPythonPackage rec {
]; ];
checkInputs = [ checkInputs = [
unittestCheckHook
httmock httmock
]; ];
checkPhase = ''
python -m unittest discover
'';
pythonImportsCheck = [ "keycloak" ]; pythonImportsCheck = [ "keycloak" ];
meta = with lib; { meta = with lib; {

View file

@ -4,7 +4,7 @@
, isPyPy , isPyPy
, snappy , snappy
, cffi , cffi
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -21,11 +21,7 @@ buildPythonPackage rec {
propagatedBuildInputs = lib.optional isPyPy cffi; propagatedBuildInputs = lib.optional isPyPy cffi;
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
meta = with lib; { meta = with lib; {
description = "Python library for the snappy compression library from Google"; description = "Python library for the snappy compression library from Google";

View file

@ -1,4 +1,4 @@
{ lib, stdenv, buildPythonPackage, fetchPypi, python, html-tidy }: { lib, stdenv, buildPythonPackage, fetchPypi, unittestCheckHook, html-tidy }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pytidylib"; pname = "pytidylib";
@ -21,9 +21,7 @@ buildPythonPackage rec {
$' @unittest.skip("")\n def test_large_document(self):' $' @unittest.skip("")\n def test_large_document(self):'
''; '';
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
description = "Python wrapper for HTML Tidy (tidylib) on Python 2 and 3"; description = "Python wrapper for HTML Tidy (tidylib) on Python 2 and 3";

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, python }: { lib, buildPythonPackage, fetchPypi, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "pytz"; pname = "pytz";
@ -9,9 +9,9 @@ buildPythonPackage rec {
sha256 = "sha256-HnYOL+aoFjvAs9mhnE+ENCr6Cir/6/qoSwG5eKAuyqc="; sha256 = "sha256-HnYOL+aoFjvAs9mhnE+ENCr6Cir/6/qoSwG5eKAuyqc=";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s pytz/tests
''; unittestFlagsArray = [ "-s" "pytz/tests" ];
pythonImportsCheck = [ "pytz" ]; pythonImportsCheck = [ "pytz" ];

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -15,9 +15,9 @@ buildPythonPackage rec {
sha256 = "1mw8j8ads8hqdbz42siwpffi4wi5s33z9g14a5c2i7vxp8m68qc1"; sha256 = "1mw8j8ads8hqdbz42siwpffi4wi5s33z9g14a5c2i7vxp8m68qc1";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s tests
''; unittestFlagsArray = [ "-s" "tests" ];
meta = with lib; { meta = with lib; {
description = "GNU Readline-like line editing module"; description = "GNU Readline-like line editing module";

View file

@ -3,7 +3,7 @@
, fetchFromGitHub , fetchFromGitHub
, pythonOlder , pythonOlder
, pycryptodome , pycryptodome
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -23,11 +23,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ pycryptodome ]; propagatedBuildInputs = [ pycryptodome ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"sjcl" "sjcl"

View file

@ -4,7 +4,7 @@
, mock , mock
, sphinx , sphinx
, six , six
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -16,12 +16,10 @@ buildPythonPackage rec {
sha256 = "ef661775b5722d7b00f67fc229104317d35637a4fb4434bf2c005afdf1da4d09"; sha256 = "ef661775b5722d7b00f67fc229104317d35637a4fb4434bf2c005afdf1da4d09";
}; };
checkInputs = [ mock ]; checkInputs = [ unittestCheckHook mock ];
propagatedBuildInputs = [ sphinx six ]; propagatedBuildInputs = [ sphinx six ];
checkPhase = '' unittestFlagsArray = [ "-s" "tests" ];
${python.interpreter} -m unittest discover -s tests
'';
# Test failures https://github.com/sphinx-doc/sphinx-testing/issues/5 # Test failures https://github.com/sphinx-doc/sphinx-testing/issues/5
doCheck = false; doCheck = false;

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
, mock , mock
, sphinx-testing , sphinx-testing
, sphinx , sphinx
@ -22,9 +22,10 @@ buildPythonPackage rec {
# Seems to look for files in the wrong dir # Seems to look for files in the wrong dir
doCheck = false; doCheck = false;
checkPhase = ''
${python.interpreter} -m unittest discover -s tests checkInputs = [ unittestCheckHook ];
'';
unittestFlagsArray = [ "-s" "tests" ];
meta = with lib; { meta = with lib; {
description = "Sphinx blockdiag extension"; description = "Sphinx blockdiag extension";

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -17,9 +17,7 @@ buildPythonPackage rec {
sha256 = "1d1l8fhdn3w2zg7wakvlmjmgjh9lh9h5fal1clgyiqmhfix4cn4m"; sha256 = "1d1l8fhdn3w2zg7wakvlmjmgjh9lh9h5fal1clgyiqmhfix4cn4m";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
description = "Python curses command line CSV and tabular data viewer"; description = "Python curses command line CSV and tabular data viewer";

View file

@ -3,7 +3,7 @@
, callPackage , callPackage
, fetchFromGitHub , fetchFromGitHub
, flit-core , flit-core
, python , unittestCheckHook
# important downstream dependencies # important downstream dependencies
, flit , flit
@ -26,13 +26,9 @@ buildPythonPackage rec {
nativeBuildInputs = [ flit-core ]; nativeBuildInputs = [ flit-core ];
pythonImportsCheck = [ "tomli" ]; checkInputs = [ unittestCheckHook ];
checkPhase = '' pythonImportsCheck = [ "tomli" ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
passthru.tests = { passthru.tests = {
# test downstream dependencies # test downstream dependencies

View file

@ -1,26 +1,27 @@
{ lib { lib
, python , unittestCheckHook
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27 , isPy27
, pythonAtLeast
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "tornado"; pname = "tornado";
version = "4.5.3"; version = "4.5.3";
disabled = isPy27 || python.pythonAtLeast "3.10"; 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 { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "02jzd23l4r6fswmwxaica9ldlyc2p6q8dk6dyff7j58fmdzf853d"; 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; __darwinAllowLocalNetworking = true;
meta = { meta = {

View file

@ -1,5 +1,5 @@
{ lib { lib
, python , unittestCheckHook
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, isPy27 , isPy27
@ -11,17 +11,17 @@ buildPythonPackage rec {
version = "5.1.1"; version = "5.1.1";
disabled = isPy27 || pythonAtLeast "3.10"; 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 { src = fetchPypi {
inherit pname version; inherit pname version;
sha256 = "4e5158d97583502a7e2739951553cbd88a72076f152b4b11b64b9a10c4c49409"; 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; __darwinAllowLocalNetworking = true;
meta = { meta = {

View file

@ -18,8 +18,9 @@
, weasyprint , weasyprint
, gevent , gevent
, pillow , pillow
, withPostgresql ? true, psycopg2 , withPostgresql ? true
, python , psycopg2
, unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -58,17 +59,16 @@ buildPythonPackage rec {
++ passlib.optional-dependencies.argon2 ++ passlib.optional-dependencies.argon2
++ lib.optional withPostgresql psycopg2; ++ lib.optional withPostgresql psycopg2;
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
preCheck = ''
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
export TRYTOND_DATABASE_URI="sqlite://" export TRYTOND_DATABASE_URI="sqlite://"
export DB_NAME=":memory:"; export DB_NAME=":memory:";
${python.interpreter} -m unittest discover -s trytond.tests
runHook postCheck
''; '';
unittestFlagsArray = [ "-s" "trytond.tests" ];
meta = with lib; { meta = with lib; {
description = "The server of the Tryton application platform"; description = "The server of the Tryton application platform";
longDescription = '' longDescription = ''

View file

@ -4,7 +4,7 @@
, twisted , twisted
, requests , requests
, cryptography , cryptography
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -21,9 +21,7 @@ buildPythonPackage rec {
# Require network access # Require network access
doCheck = false; doCheck = false;
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = with lib; { meta = with lib; {
description = "Asynchronous Python HTTP for Humans."; description = "Asynchronous Python HTTP for Humans.";

View file

@ -2,7 +2,7 @@
, lib , lib
, fetchPypi , fetchPypi
, glibcLocales , glibcLocales
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -18,9 +18,7 @@ buildPythonPackage rec {
buildInputs = [ glibcLocales ]; buildInputs = [ glibcLocales ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover
'';
meta = { meta = {
description = "A portable, lightweight MessagePack serializer and deserializer written in pure Python"; description = "A portable, lightweight MessagePack serializer and deserializer written in pure Python";

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, python }: { lib, buildPythonPackage, fetchPypi, unittestCheckHook }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "unidiff"; pname = "unidiff";
@ -9,9 +9,9 @@ buildPythonPackage rec {
sha256 = "2bbcbc986e1fb97f04b1d7b864aa6002ab02f4d8a996bf03aa6e5a81447d1fc5"; sha256 = "2bbcbc986e1fb97f04b1d7b864aa6002ab02f4d8a996bf03aa6e5a81447d1fc5";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s tests/
''; unittestFlagsArray = [ "-s" "tests" ];
pythonImportsCheck = [ "unidiff" ]; pythonImportsCheck = [ "unidiff" ];

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, untokenize , untokenize
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -19,7 +19,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ untokenize ]; propagatedBuildInputs = [ untokenize ];
checkPhase = "${python.interpreter} -m unittest discover"; checkInputs = [ unittestCheckHook ];
meta = with lib; { meta = with lib; {
description = "Modifies strings to all use the same quote where possible"; description = "Modifies strings to all use the same quote where possible";

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchFromGitHub, python, defusedxml }: { lib, buildPythonPackage, fetchFromGitHub, unittestCheckHook, defusedxml }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "untangle"; pname = "untangle";
@ -16,9 +16,9 @@ buildPythonPackage rec {
defusedxml defusedxml
]; ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s tests
''; unittestFlagsArray = [ "-s" "tests" ];
meta = with lib; { meta = with lib; {
description = "Convert XML documents into Python objects"; description = "Convert XML documents into Python objects";

View file

@ -1,7 +1,7 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -13,7 +13,7 @@ buildPythonPackage rec {
sha256 = "3865dbbbb8efb4bb5eaa72f1be7f3e0be00ea8b7f125c69cbd1f5fda926f37a2"; sha256 = "3865dbbbb8efb4bb5eaa72f1be7f3e0be00ea8b7f125c69cbd1f5fda926f37a2";
}; };
checkPhase = "${python.interpreter} -m unittest discover"; checkInputs = [ unittestCheckHook ];
meta = with lib; { meta = with lib; {
description = "Transforms tokens into original source code while preserving whitespace"; description = "Transforms tokens into original source code while preserving whitespace";

View file

@ -1,4 +1,4 @@
{ vapoursynth, cython, buildPythonPackage, python }: { vapoursynth, cython, buildPythonPackage, unittestCheckHook }:
buildPythonPackage { buildPythonPackage {
pname = "vapoursynth"; pname = "vapoursynth";
@ -13,9 +13,11 @@ buildPythonPackage {
vapoursynth vapoursynth
]; ];
checkPhase = '' checkInputs = [
${python.interpreter} -m unittest discover -s $src/test -p "*test.py" unittestCheckHook
''; ];
unittestFlagsArray = [ "-s" "$src/test" "-p" "'*test.py'" ];
inherit (vapoursynth) meta; inherit (vapoursynth) meta;
} }

View file

@ -2,7 +2,7 @@
, buildPythonPackage , buildPythonPackage
, fetchPypi , fetchPypi
, pythonOlder , pythonOlder
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -17,9 +17,9 @@ buildPythonPackage rec {
hash = "sha256-FtBD06CP1qGxt+Pp5iZA0JeQ3OgNK91HkqF1s1/nlKk="; hash = "sha256-FtBD06CP1qGxt+Pp5iZA0JeQ3OgNK91HkqF1s1/nlKk=";
}; };
checkPhase = '' checkInputs = [ unittestCheckHook ];
${python.interpreter} -m unittest discover -s tests
''; unittestFlagsArray = [ "-s" "tests" ];
pythonImportsCheck = [ pythonImportsCheck = [
"webcolors" "webcolors"

View file

@ -2,7 +2,7 @@
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, python , unittestCheckHook
, pythonOlder , pythonOlder
}: }:
@ -44,11 +44,7 @@ buildPythonPackage rec {
done done
''; '';
checkPhase = '' checkInputs = [ unittestCheckHook ];
runHook preCheck
${python.interpreter} -m unittest discover
runHook postCheck
'';
pythonImportsCheck = [ pythonImportsCheck = [
"websockets" "websockets"

View file

@ -4,7 +4,7 @@
, kazoo , kazoo
, six , six
, testtools , testtools
, python , unittestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
@ -18,14 +18,15 @@ buildPythonPackage rec {
propagatedBuildInputs = [ kazoo six ]; propagatedBuildInputs = [ kazoo six ];
buildInputs = [ testtools ]; buildInputs = [ testtools ];
checkPhase = '' checkInputs = [ unittestCheckHook ];
preCheck = ''
# Skip test - fails with our new kazoo version # Skip test - fails with our new kazoo version
substituteInPlace zake/tests/test_client.py \ substituteInPlace zake/tests/test_client.py \
--replace "test_child_watch_no_create" "_test_child_watch_no_create" --replace "test_child_watch_no_create" "_test_child_watch_no_create"
${python.interpreter} -m unittest discover zake/tests
''; '';
unittestFlagsArray = [ "zake/tests" ];
meta = with lib; { meta = with lib; {
homepage = "https://github.com/yahoo/Zake"; homepage = "https://github.com/yahoo/Zake";
description = "A python package that works to provide a nice set of testing utilities for the kazoo library"; description = "A python package that works to provide a nice set of testing utilities for the kazoo library";

View file

@ -5,6 +5,7 @@
, zope_interface , zope_interface
, zope_location , zope_location
, zope_schema , zope_schema
, unittestCheckHook
}: }:
@ -20,11 +21,9 @@ buildPythonPackage rec {
propagatedBuildInputs = [ zope_interface ]; propagatedBuildInputs = [ zope_interface ];
doCheck = !isPy27; # namespace conflicts doCheck = !isPy27; # namespace conflicts
checkInputs = [ zope_location zope_schema ]; checkInputs = [ unittestCheckHook zope_location zope_schema ];
checkPhase = '' unittestFlagsArray = [ "-s" "src/zope/copy" ];
python -m unittest discover -s src/zope/copy
'';
meta = { meta = {
maintainers = with lib.maintainers; [ domenkozar ]; maintainers = with lib.maintainers; [ domenkozar ];

View file

@ -5,7 +5,7 @@
, funcsigs , funcsigs
, six , six
, pbr , pbr
, python , unittestCheckHook
, pytest , pytest
}: }:
@ -27,11 +27,8 @@ buildPythonPackage rec {
#doCheck = !(python.isPyPy && python.isPy27); #doCheck = !(python.isPyPy && python.isPy27);
doCheck = false; # Infinite recursion pytest doCheck = false; # Infinite recursion pytest
checkPhase = ''
${python.interpreter} -m unittest discover
'';
checkInputs = [ checkInputs = [
unittestCheckHook
pytest pytest
]; ];

View file

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, python { lib, buildPythonPackage, fetchPypi, pythonOlder, isPy3k, isPyPy, unittestCheckHook
, pythonAtLeast }: , pythonAtLeast }:
let let
@ -20,10 +20,9 @@ in buildPythonPackage rec {
# Also, don't bother on PyPy: AssertionError: TypeError not raised # Also, don't bother on PyPy: AssertionError: TypeError not raised
doCheck = pythonOlder "3.6" && !isPyPy; doCheck = pythonOlder "3.6" && !isPyPy;
checkPhase = '' checkInputs = [ unittestCheckHook ];
cd ${testDir}
${python.interpreter} -m unittest discover unittestFlagsArray = [ "-s" testDir ];
'';
meta = with lib; { meta = with lib; {
description = "Backport of typing module to Python versions older than 3.5"; description = "Backport of typing module to Python versions older than 3.5";

View file

@ -2,6 +2,7 @@
, fetchFromGitHub , fetchFromGitHub
, python3Packages , python3Packages
, prometheus-alertmanager , prometheus-alertmanager
, unittestCheckHook
}: }:
python3Packages.buildPythonApplication rec { python3Packages.buildPythonApplication rec {
@ -25,13 +26,10 @@ python3Packages.buildPythonApplication rec {
]); ]);
checkInputs = with python3Packages; [ checkInputs = with python3Packages; [
unittestCheckHook
pytz pytz
]; ];
checkPhase = ''
${python3Packages.python.interpreter} -m unittest discover
'';
meta = { meta = {
description = "XMPP Web hook for Prometheus"; description = "XMPP Web hook for Prometheus";
homepage = "https://github.com/jelmer/prometheus-xmpp-alerts"; homepage = "https://github.com/jelmer/prometheus-xmpp-alerts";

View file

@ -42,8 +42,7 @@ python3.pkgs.buildPythonApplication rec {
pixiewps pixiewps
]; ];
checkInputs = propagatedBuildInputs; checkInputs = propagatedBuildInputs ++ [ python3.pkgs.unittestCheckHook ];
checkPhase = "python -m unittest discover tests -v";
meta = with lib; { meta = with lib; {
homepage = "https://github.com/kimocoder/wifite2"; homepage = "https://github.com/kimocoder/wifite2";