[pacman-dev] [PATCH 5/7] pactest: accept test names without a switch
Andrew Gregory
andrew.gregory.8 at gmail.com
Fri Aug 2 08:34:12 EDT 2013
This removes the --test switch, making it easier to call pactest from
a test harness.
Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
Makefile.am | 4 ++--
test/pacman/pactest.py | 21 ++++-----------------
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index 28f7f8f..1adf0f8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,10 +28,10 @@ check-local: test-pacman test-pacsort test-vercmp test-parseopts
test-pacman: test/pacman src/pacman
$(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
- --test $(top_srcdir)/test/pacman/tests/*.py \
--scriptlet-shell $(SCRIPTLET_SHELL) \
--ldconfig $(LDCONFIG) \
- -p $(top_builddir)/src/pacman/pacman
+ -p $(top_builddir)/src/pacman/pacman \
+ $(top_srcdir)/test/pacman/tests/*.py
test-pacsort: test/util src/util
$(BASH_SHELL) $(top_srcdir)/test/util/pacsorttest.sh \
diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index fe04c2b..e92864d 100755
--- a/test/pacman/pactest.py
+++ b/test/pacman/pactest.py
@@ -35,21 +35,8 @@
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 <path/to/testfile.py>] ...]"
+ usage = "usage: %prog [options] <path/to/testfile.py>..."
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 @@ def create_parser():
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)
--
1.8.3.4
More information about the pacman-dev
mailing list