From 228221003df40fa0782656d0e32d6ad072a4eec1 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 29 Jul 2013 15:34:04 -0400 Subject: pactest: accept test names without a switch This removes the --test switch, making it easier to call pactest from a test harness. Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- test/pacman/pactest.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'test') diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py index fe04c2b3..e92864d7 100755 --- a/test/pacman/pactest.py +++ b/test/pacman/pactest.py @@ -35,21 +35,8 @@ __version__ = "0.4" def resolve_binary_path(option, opt_str, value, parser): setattr(parser.values, option.dest, os.path.abspath(value)) -def glob_tests(option, opt_str, value, parser): - idx = 0 - globlist = [] - - # maintain the idx so we can modify rargs - while idx < len(parser.rargs) and \ - not parser.rargs[idx].startswith('-'): - globlist += glob.glob(parser.rargs[idx]) - idx += 1 - - parser.rargs = parser.rargs[idx:] - setattr(parser.values, option.dest, globlist) - def create_parser(): - usage = "usage: %prog [options] [[--test ] ...]" + usage = "usage: %prog [options] ..." description = "Runs automated tests on the pacman binary. Tests are " \ "described using an easy python syntax, and several can be " \ "ran at once." @@ -65,9 +52,6 @@ def create_parser(): callback = resolve_binary_path, type = "string", dest = "bin", default = "pacman", help = "specify location of the pacman binary") - parser.add_option("-t", "--test", action = "callback", - callback = glob_tests, dest = "testcases", - help = "specify test case(s)") parser.add_option("--keep-root", action = "store_true", dest = "keeproot", default = False, help = "don't remove the generated pacman root filesystem") @@ -110,6 +94,9 @@ if __name__ == "__main__": env.pacman["scriptlet-shell"] = opts.scriptletshell env.pacman["ldconfig"] = opts.ldconfig + opts.testcases = [] + for path in args: + opts.testcases += glob.glob(path) if opts.testcases is None or len(opts.testcases) == 0: tap.bail("no tests defined, nothing to do") os.rmdir(root_path) -- cgit v1.2.3-24-g4f1b