From 42ea4e747d2dc9540b4bb548d5996a1777be7bcb Mon Sep 17 00:00:00 2001 From: Nicolas Graves Date: Sat, 7 Feb 2026 21:33:41 +0100 Subject: [PATCH] gnu: nmap: Fix tests under python@3.12. * gnu/packages/admin.scm (nmap)[arguments]<#:phases>: Add phase 'fix-tests-for-python-3.12. Change-Id: I9f4aa9fceca2d922e00b6305878e137644c2a39f Signed-off-by: Sharlatan Hellseher --- gnu/packages/admin.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gnu/packages/admin.scm b/gnu/packages/admin.scm index d9e06c0c08..e2eae14064 100644 --- a/gnu/packages/admin.scm +++ b/gnu/packages/admin.scm @@ -3909,6 +3909,18 @@ rules is done with the @code{auditctl} utility.") (wrap-program (string-append ndiff "/bin/ndiff") `("GUIX_PYTHONPATH" prefix (,(python-path ndiff))))))) + (add-before 'check 'fix-tests-for-python-3.12 + (lambda _ + (substitute* "ndiff/ndifftest.py" + (("import imp") + "import importlib.util") + (("ndiff = imp\\.load_source\\(\"ndiff\", \"ndiff\\.py\"\\)") + (string-join + '("spec = \ +importlib.util.spec_from_file_location(\"ndiff\", \"ndiff.py\")" + "ndiff = importlib.util.module_from_spec(spec)" + "spec.loader.exec_module(ndiff)") + "\n"))))) ;; These are the tests that do not require network access. (replace 'check (lambda* (#:key tests? #:allow-other-keys)