From dc16356f77e266327c2dd078c8d4d060ca5aa71b Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Wed, 23 Feb 2022 08:59:22 +0100 Subject: [PATCH 1/2] paperless-ng: fix slow_write_pdf test --- pkgs/applications/office/paperless-ng/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/applications/office/paperless-ng/default.nix b/pkgs/applications/office/paperless-ng/default.nix index 2fcb2388b8c8..0b8abe5d3f10 100644 --- a/pkgs/applications/office/paperless-ng/default.nix +++ b/pkgs/applications/office/paperless-ng/default.nix @@ -1,5 +1,6 @@ { lib , fetchurl +, fetchpatch , nixosTests , python3 , ghostscript @@ -54,6 +55,15 @@ py.pkgs.pythonPackages.buildPythonApplication rec { sha256 = "oVSq0AWksuWC81MF5xiZ6ZbdKKtqqphmL+xIzJLaDMw="; }; + patches = [ + # Fix the `slow_write_pdf` test: + # https://github.com/NixOS/nixpkgs/issues/136626 + (fetchpatch { + url = "https://github.com/paperless-ngx/paperless-ngx/commit/4fbabe43ea12811864e9676b04d82a82b38e799d.patch"; + sha256 = "sha256-8ULep5aeW3wJAQGy2OEAjFYybELNq1DzCC1uBrZx36I="; + }) + ]; + format = "other"; # Make bind address configurable From 95f3334e3ebca749c1cccc34a22f5c4cfd67b2ce Mon Sep 17 00:00:00 2001 From: Johannes Schleifenbaum Date: Wed, 23 Feb 2022 08:59:36 +0100 Subject: [PATCH 2/2] paperless-ng: use pytestCheckHook and reorganize the checkPhase --- .../office/paperless-ng/default.nix | 46 ++++++++++--------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/pkgs/applications/office/paperless-ng/default.nix b/pkgs/applications/office/paperless-ng/default.nix index 0b8abe5d3f10..e3ca9af422c2 100644 --- a/pkgs/applications/office/paperless-ng/default.nix +++ b/pkgs/applications/office/paperless-ng/default.nix @@ -165,27 +165,6 @@ py.pkgs.pythonPackages.buildPythonApplication rec { zope_interface ]; - doCheck = true; - checkInputs = with py.pkgs.pythonPackages; [ - pytest - pytest-cov - pytest-django - pytest-env - pytest-sugar - pytest-xdist - factory_boy - ]; - - # The tests require: - # - PATH with runtime binaries - # - A temporary HOME directory for gnupg - # - XDG_DATA_DIRS with test-specific fonts - checkPhase = '' - pushd src - PATH="${path}:$PATH" HOME=$(mktemp -d) XDG_DATA_DIRS="${liberation_ttf}/share:$XDG_DATA_DIRS" pytest - popd - ''; - installPhase = '' mkdir -p $out/lib cp -r . $out/lib/paperless-ng @@ -195,6 +174,31 @@ py.pkgs.pythonPackages.buildPythonApplication rec { --prefix PATH : "${path}" ''; + checkInputs = with py.pkgs.pythonPackages; [ + pytest-django + pytest-env + pytest-sugar + pytest-xdist + factory_boy + pytestCheckHook + ]; + + pytestFlagsArray = [ "src" ]; + + # The tests require: + # - PATH with runtime binaries + # - A temporary HOME directory for gnupg + # - XDG_DATA_DIRS with test-specific fonts + preCheck = '' + export PATH="${path}:$PATH" + export HOME=$(mktemp -d) + export XDG_DATA_DIRS="${liberation_ttf}/share:$XDG_DATA_DIRS" + + # Disable unneeded code coverage test + substituteInPlace src/setup.cfg \ + --replace "--cov --cov-report=html" "" + ''; + passthru = { # PYTHONPATH of all dependencies used by the package pythonPath = python3.pkgs.makePythonPath propagatedBuildInputs;