From c32617fd88fce776fa2331f34fceda79e40011f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 13 Dec 2024 17:31:24 +0100 Subject: [PATCH] paperless-ngx: re-add xdist Without it the tests run in ~12 1/2 minutes. With it and max 8 cores they only take 2 1/2 minutes but sometimes fail. Lets max at 4 which takes 3 1/2 minutes. Upstream maxes at 16 by default which doesn't work for us. --- pkgs/by-name/pa/paperless-ngx/package.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/pa/paperless-ngx/package.nix b/pkgs/by-name/pa/paperless-ngx/package.nix index 3fcf619c7921..4005d852a895 100644 --- a/pkgs/by-name/pa/paperless-ngx/package.nix +++ b/pkgs/by-name/pa/paperless-ngx/package.nix @@ -161,9 +161,12 @@ python.pkgs.buildPythonApplication rec { ]; postPatch = '' - # pytest-xdist makes the tests flaky + # pytest-xdist with to many threads makes the tests flaky + if (( $NIX_BUILD_CORES > 4)); then + NIX_BUILD_CORES=4 + fi substituteInPlace src/setup.cfg \ - --replace-fail "--numprocesses auto --maxprocesses=16" "" + --replace-fail "--numprocesses auto --maxprocesses=16" "--numprocesses $NIX_BUILD_CORES" ''; nativeBuildInputs = [ @@ -277,9 +280,13 @@ python.pkgs.buildPythonApplication rec { pytest-httpx pytest-mock pytest-rerunfailures + pytest-xdist pytestCheckHook ]; + # manually managed in postPatch + dontUsePytestXdist = false; + pytestFlagsArray = [ "src" ];