From 0e7ffca8e7c27289fef62989b192bf31dc8e43e5 Mon Sep 17 00:00:00 2001 From: Bryan Lai Date: Fri, 28 Feb 2025 14:23:59 +0800 Subject: [PATCH] newt, python3Packages.snack: add passthru.tests --- pkgs/by-name/ne/newt/package.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkgs/by-name/ne/newt/package.nix b/pkgs/by-name/ne/newt/package.nix index d70c31e27f8c..4d7fd3fa2a1d 100644 --- a/pkgs/by-name/ne/newt/package.nix +++ b/pkgs/by-name/ne/newt/package.nix @@ -62,6 +62,26 @@ stdenv.mkDerivation rec { install_name_tool -change libnewt.so.${version} $out/lib/libnewt.so.${version} $out/bin/whiptail ''; + passthru.tests.pythonModule = (python3.withPackages (ps: [ ps.snack ])).overrideAttrs ( + { nativeBuildInputs, postBuild, ... }@_prevAttrs: + { + nativeBuildInputs = nativeBuildInputs ++ [ python3.pkgs.pythonImportsCheckHook ]; + pythonImportsCheck = [ "snack" ]; + /** + Call pythonImportsCheckPhase manually. This is necessary because: + - pythonImportsCheckHook adds the check to $preDistPhases + - python3.withPackages is built with a version of `buildEnv`, + ... which is implemented by `runCommand`, + ... which has a custom builder and does not run $preDistPhases + */ + postBuild = + postBuild + + '' + runPhase pythonImportsCheckPhase + ''; + } + ); + meta = { description = "Library for color text mode, widget based user interfaces"; mainProgram = "whiptail";