summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-04-07 01:20:55 +0200
committerAllan McRae <allan@archlinux.org>2014-05-04 08:20:11 +0200
commit00fbdabc55c1de28f65eef27cb6448608c3d4e1f (patch)
treecdb08cf299e0cf057732da65ed39e027b47cdbba
parent80d3709e65e9ee778f6a26235516b990290b49e0 (diff)
downloadpacman-00fbdabc55c1de28f65eef27cb6448608c3d4e1f.tar.gz
pacman-00fbdabc55c1de28f65eef27cb6448608c3d4e1f.tar.xz
pactest: treat arguments as files instead of globs
glob() returns an empty list if input does not match any files, causing non-existent test files to be silently skipped. Treating arguments as files causes pactest to immediately bail out with an appropriate error message on non-existent files. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
-rwxr-xr-xtest/pacman/pactest.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index d80076e2..0e06f17d 100755
--- a/test/pacman/pactest.py
+++ b/test/pacman/pactest.py
@@ -18,7 +18,6 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import glob
from optparse import OptionParser
import os
import shutil
@@ -100,16 +99,18 @@ 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:
+ if args is None or len(args) == 0:
tap.bail("no tests defined, nothing to do")
os.rmdir(root_path)
sys.exit(2)
- for i in opts.testcases:
- env.addtest(i)
+ try:
+ for i in args:
+ env.addtest(i)
+ except Exception as e:
+ tap.bail(e)
+ os.rmdir(root_path)
+ sys.exit(2)
# run tests
env.run()