Kiln » Kiln Extensions
Clone URL:  
runner.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os import subprocess import sys import hgtest path = os.path.dirname(os.path.realpath(__file__)) args = vars(hgtest.parse_args()) arglist = [] for opt, val in args.iteritems(): arglist.extend(['--' + opt, val]) files = os.listdir(path) failures = 0 for file in files: if file.startswith("test") and file.endswith(".py"): try: child = subprocess.Popen(["python", os.path.join(path, file)] + arglist, stdout=sys.stdout, stderr=sys.stderr, stdin=sys.stdin, universal_newlines=True) ret = child.wait() if ret != 0: failures += 1 except: if child.poll(): child.kill() raise if failures > 0: sys.exit("%i files failed" % failures)