From f5d477195e9bac6715b6f1ed0a5fb4bb4410b2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 22 Nov 2021 13:07:34 -0800 Subject: [PATCH 1/2] python3Packages.html5lib: use pytestCheckHook (cherry picked from commit 49cf63ccc9e6a9c27737f060c9ecf97075e610dd) --- .../python-modules/html5lib/default.nix | 22 +++++++++---------- pkgs/top-level/python-packages.nix | 5 +++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/pkgs/development/python-modules/html5lib/default.nix b/pkgs/development/python-modules/html5lib/default.nix index f0abbcfbecce..1172b0195132 100644 --- a/pkgs/development/python-modules/html5lib/default.nix +++ b/pkgs/development/python-modules/html5lib/default.nix @@ -1,12 +1,11 @@ { lib , buildPythonPackage , fetchPypi -, flake8 -, pytest_4 -, pytest-expect -, mock , six , webencodings +, mock +, pytest-expect +, pytestCheckHook_5 }: buildPythonPackage rec { @@ -18,17 +17,16 @@ buildPythonPackage rec { sha256 = "b2e5b40261e20f354d198eae92afc10d750afb487ed5e50f9c4eaf07c184146f"; }; - checkInputs = [ flake8 pytest_4 pytest-expect mock ]; propagatedBuildInputs = [ - six webencodings + six + webencodings ]; - checkPhase = '' - # remove test causing error - # https://github.com/html5lib/html5lib-python/issues/411 - rm html5lib/tests/test_stream.py - py.test - ''; + checkInputs = [ + mock + pytest-expect + pytestCheckHook_5 + ]; meta = { homepage = "https://github.com/html5lib/html5lib-python"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 798f375dd894..ef432308a31d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -137,6 +137,11 @@ in { # it should not override the version of pytest that is used for say # Python 2. This is an ugly hack that is needed now because the hook # propagates the package. + pytestCheckHook_5 = if isPy3k then + self.pytestCheckHook.override { pytest = self.pytest_5; } + else + self.pytestCheckHook; + pytestCheckHook_6_1 = if isPy3k then self.pytestCheckHook.override { pytest = self.pytest_6_1; } else From 6bb4295706d256a023ad271844315abff9b29452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Mon, 22 Nov 2021 13:23:45 -0800 Subject: [PATCH 2/2] python2Packages.construct: skip tests that require broken packages (cherry picked from commit 192bbb938c50917e8a411ab0a73cba893dac0dbc) --- .../python-modules/construct/2.10.54.nix | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/construct/2.10.54.nix b/pkgs/development/python-modules/construct/2.10.54.nix index 30d303b60cd0..6cfca7260512 100644 --- a/pkgs/development/python-modules/construct/2.10.54.nix +++ b/pkgs/development/python-modules/construct/2.10.54.nix @@ -14,9 +14,20 @@ buildPythonPackage rec { sha256 = "1mqspsn6bf3ibvih1zna2glkg8iw7vy5zg9gzg0d1m8zcndk2c48"; }; - checkInputs = [ pytestCheckHook pytest-benchmark enum34 numpy arrow ruamel-yaml ]; + checkInputs = [ pytestCheckHook pytest-benchmark enum34 numpy ]; - disabledTests = lib.optionals stdenv.isDarwin [ "test_multiprocessing" ]; + # these have dependencies that are broken on Python 2 + disabledTestPaths = [ + "tests/gallery/test_gallery.py" + "tests/test_benchmarks.py" + "tests/test_compiler.py" + ]; + + disabledTests = [ + "test_timestamp" + ] ++ lib.optionals stdenv.isDarwin [ + "test_multiprocessing" + ]; pytestFlagsArray = [ "--benchmark-disable" ];