[pacman-dev] [PATCH 3/3] pactest: check for tests before environment setup

Andrew Gregory andrew.gregory.8 at gmail.com
Fri Jul 4 17:10:30 EDT 2014


Setting up the temporary directory and environment is pointless if there
are no tests to run.

Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
---
 test/pacman/pactest.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index cba439c..58c14f6 100755
--- a/test/pacman/pactest.py
+++ b/test/pacman/pactest.py
@@ -90,6 +90,10 @@ def create_parser():
         tap.bail("cannot locate pacman binary")
         sys.exit(2)
 
+    if args is None or len(args) == 0:
+        tap.bail("no tests defined, nothing to do")
+        sys.exit(2)
+
     # instantiate env
     root_path = tempfile.mkdtemp(prefix='pactest-')
     env = pmenv.pmenv(root=root_path)
@@ -105,11 +109,6 @@ def create_parser():
     env.pacman["scriptlet-shell"] = opts.scriptletshell
     env.pacman["ldconfig"] = opts.ldconfig
 
-    if args is None or len(args) == 0:
-        tap.bail("no tests defined, nothing to do")
-        os.rmdir(root_path)
-        sys.exit(2)
-
     try:
         for i in args:
             env.addtest(i)
-- 
2.0.1



More information about the pacman-dev mailing list