summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAcriusWinter <152348900+AcriusWinter@users.noreply.github.com>2024-07-26 13:07:06 -0700
committerGitHub <noreply@github.com>2024-07-26 14:07:06 -0600
commit057b41507462f2aa9a151d59c8ebea96f271cee2 (patch)
treef4359b22f12c34800a3508ad371238ddb2c50dfa
parent3180b28d76d951eea44de1af6b6c8812b35962ab (diff)
downloadspack-057b41507462f2aa9a151d59c8ebea96f271cee2.tar.gz
spack-057b41507462f2aa9a151d59c8ebea96f271cee2.tar.bz2
spack-057b41507462f2aa9a151d59c8ebea96f271cee2.tar.xz
spack-057b41507462f2aa9a151d59c8ebea96f271cee2.zip
pinentry: old to new test API (#45011)
* pinentry: New API * move code around * added back version check * Complete check_version refactor * Honor original handling of guis (i.e., don't try if not there) --------- Co-authored-by: Tamara Dahlgren <dahlgren1@llnl.gov>
-rw-r--r--var/spack/repos/builtin/packages/pinentry/package.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/var/spack/repos/builtin/packages/pinentry/package.py b/var/spack/repos/builtin/packages/pinentry/package.py
index 81b166f3a3..d4d9876766 100644
--- a/var/spack/repos/builtin/packages/pinentry/package.py
+++ b/var/spack/repos/builtin/packages/pinentry/package.py
@@ -3,7 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-
from spack.package import *
@@ -95,17 +94,24 @@ class Pinentry(AutotoolsPackage):
args.append("--enable-pinentry-" + gui)
else:
args.append("--disable-pinentry-" + gui)
-
return args
- def test(self):
- kwargs = {
- "exe": self.prefix.bin.pinentry,
- "options": ["--version"],
- "expected": [str(self.version)],
- }
- self.run_test(**kwargs)
+ def check_version(self, exe_name):
+ """Version check"""
+ exe = which(join_path(self.prefix.bin, exe_name))
+ out = exe("--version", output=str.split, error=str.split)
+ assert str(self.version) in out
+
+ def test_pinentry(self):
+ """Confirm pinentry version"""
+ self.check_version("pinentry")
+
+ def test_guis(self):
+ """Check gui versions"""
for gui in self.supported_guis:
- if "gui=" + gui in self.spec:
- kwargs["exe"] = self.prefix.bin.pinentry + "-" + gui
- self.run_test(**kwargs)
+ if f"gui={gui}" not in self.spec:
+ continue
+
+ exe_name = f"pinentry-{gui}"
+ with test_part(self, f"test_guis_{gui}", purpose=f"Check {exe_name} version"):
+ self.check_version(exe_name)