pactest: check for tests before environment setup

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

Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
This commit is contained in:
Andrew Gregory 2014-07-04 17:02:06 -04:00 committed by Allan McRae
parent 6650c43fca
commit 73717f89df
1 changed files with 4 additions and 5 deletions

View File

@ -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)