From 77e8d6f0583d251b8f645d216ca9ac0eb436238f Mon Sep 17 00:00:00 2001 From: hellwolf Date: Sun, 24 Mar 2024 18:43:18 +0200 Subject: [PATCH] slither-analyzer: add testing in the check phase - use setuptools-scm --- .../slither-analyzer/default.nix | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/pkgs/development/python-modules/slither-analyzer/default.nix b/pkgs/development/python-modules/slither-analyzer/default.nix index bccc5b97f728..d188aa1557c4 100644 --- a/pkgs/development/python-modules/slither-analyzer/default.nix +++ b/pkgs/development/python-modules/slither-analyzer/default.nix @@ -7,7 +7,7 @@ , packaging , prettytable , pythonOlder -, setuptools +, setuptools-scm , solc , web3 , withSolc ? false @@ -31,7 +31,7 @@ buildPythonPackage rec { nativeBuildInputs = [ makeWrapper - setuptools + setuptools-scm ]; propagatedBuildInputs = [ @@ -68,14 +68,19 @@ buildPythonPackage rec { "slither.vyper_parsing" ]; - # No Python tests - doCheck = false; + # Test if the binary works during the build phase. + checkPhase = '' + runHook preCheck - passthru.tests = { - version = testers.testVersion { - package = slither-analyzer; - command = "HOME=$TMPDIR slither --version"; - }; + HOME="$TEMP" $out/bin/slither --version + + runHook postCheck + ''; + + passthru.tests.version = testers.testVersion { + package = slither-analyzer; + command = "HOME=$TMPDIR slither --version"; + version = "${version}"; }; meta = with lib; {