From 9c0ac5691c5c8e8902fe5a93599b07e3f21464aa Mon Sep 17 00:00:00 2001 From: Artturin Date: Fri, 20 Jan 2023 18:57:13 +0200 Subject: [PATCH] tests.overriding: init only outputs the first failing test atm --- pkgs/test/default.nix | 2 ++ pkgs/test/overriding.nix | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 pkgs/test/overriding.nix diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 818001018b3a..445aa9a75678 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -59,6 +59,8 @@ with pkgs; nixos-functions = callPackage ./nixos-functions {}; + overriding = callPackage ./overriding.nix { }; + patch-shebangs = callPackage ./patch-shebangs {}; texlive = callPackage ./texlive {}; diff --git a/pkgs/test/overriding.nix b/pkgs/test/overriding.nix new file mode 100644 index 000000000000..eab710af5afa --- /dev/null +++ b/pkgs/test/overriding.nix @@ -0,0 +1,23 @@ +{ lib, pkgs, stdenvNoCC }: + +let + tests = + let + p = pkgs.python3Packages.xpybutil.overridePythonAttrs (_: { dontWrapPythonPrograms = true; }); + in + [ + ({ + name = "overridePythonAttrs"; + expr = !lib.hasInfix "wrapPythonPrograms" p.postFixup; + expected = true; + }) + ]; +in + +stdenvNoCC.mkDerivation { + name = "test-overriding"; + passthru = { inherit tests; }; + buildCommand = '' + touch $out + '' + lib.concatMapStringsSep "\n" (t: "([[ ${lib.boolToString t.expr} == ${lib.boolToString t.expected} ]] && echo '${t.name} success') || (echo '${t.name} fail' && exit 1)") tests; +}