Commits
1 1 | ### |
2 2 | ### use like: |
3 3 | ### |
4 4 | ### PYTHONPATH=build/lib.macosx-10.12-x86_64-3.6 python tests/run.py tests/tools/image/test_ia_imageconcat.py tests/tools/image/test_ia_makecomplex.py |
5 5 | ### |
6 6 | import os |
7 7 | import sys |
8 8 | import time |
9 9 | import inspect |
10 10 | import unittest |
11 11 | import subprocess |
12 + | import shutil |
12 13 | from subprocess import Popen, PIPE |
13 - | from distutils.dir_util import remove_tree |
14 14 | from xml.sax.saxutils import escape |
15 15 | |
16 + | |
16 17 | ### |
17 18 | ### xUnit generation |
18 19 | ### |
19 20 | |
20 21 | xml_escape_table = { |
21 22 | "&": "&", |
22 23 | '"': """, |
23 24 | "'": "'", |
24 25 | ">": ">", |
25 26 | "<": "<", |
108 109 | if len(sys.argv) == 1: |
109 110 | tests = [ ] |
110 111 | run_py = os.path.realpath(__file__) |
111 112 | test_dir = os.path.dirname(run_py) |
112 113 | |
113 114 | for dir, subdirs, files in os.walk(test_dir): |
114 115 | for f in files: |
115 116 | if f.endswith(".py") and f.startswith("test_"): |
116 117 | workingdir = "%s/work/%s" % (test_dir,f[:-3]) |
117 118 | if os.path.exists(workingdir): |
118 - | remove_tree(workingdir) |
119 + | shutil.rmtree(workingdir) |
119 120 | mkpath(workingdir) |
120 121 | tests.append((os.path.abspath("%s/%s" % (dir,f)),workingdir)) |
121 122 | |
122 123 | testwidth = 0 if len(tests) == 0 else max(map(lambda x: len(os.path.basename(x[0]))+3,tests)) |
123 124 | tabwidth = max(testwidth,45) |
124 125 | |
125 126 | start_time = time.time() |
126 127 | |
127 128 | results = list(map(lambda params: run_test(tabwidth,*params),tests)) |
128 129 | |