diff options
author | Andrew Gregory <andrew.gregory.8@gmail.com> | 2018-12-22 22:24:41 -0800 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2019-01-04 11:10:47 +1000 |
commit | 2d403709d97cca381873a9d56cd37f51c0f3eade (patch) | |
tree | 201ca01daaeaf3a242c78684ea5fc5e7ff23758f /test/pacman/pmtest.py | |
parent | ecac357c1a20f3e09ae979397e5efd225b03f895 (diff) | |
download | pacman-2d403709d97cca381873a9d56cd37f51c0f3eade.tar.xz |
allow tests for disabled features to be skipped
Previously, pacman's test suite would fail when compiled without
signature support.
Adds a require_capability method to pmtest objects. Currently
recognized values are 'gpg', 'curl', and 'nls'; although only gpg is
used presently. Missing features are indicated by running pactest with
one of the --without-<feature> options.
This modifies pmenv to run each case as independent tests. Previously,
a single pmenv could run multiple tests, combining there output into
a single TAP stream but making it impossible to properly skip an entire
test case. This change does not affect running pactest.py with a single
test (as both autotools and meson do), but will affect anybody manually
running pactest.py with multiple tests at once.
Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'test/pacman/pmtest.py')
-rw-r--r-- | test/pacman/pmtest.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index 00012ac6..274677d2 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -33,12 +33,13 @@ class pmtest(object): """Test object """ - def __init__(self, name, root): + def __init__(self, name, root, config): self.name = name self.testname = os.path.basename(name).replace('.py', '') self.root = root self.dbver = 9 self.cachepkgs = True + self.config = config self.cmd = ["pacman", "--noconfirm", "--config", self.configfile(), "--root", self.rootdir(), @@ -101,6 +102,7 @@ class pmtest(object): self.rules = [] self.files = [] self.expectfailure = False + self.skipall = False if os.path.isfile(self.name): # all tests expect this to be available @@ -201,6 +203,10 @@ class pmtest(object): self.files.append(f) vprint("\t%s" % f.name) + def require_capability(self, cap): + if not self.config[cap]: + self.skipall = "missing capability " + cap + def add_hook(self, name, content): if not name.endswith(".hook"): name = name + ".hook" |