36
36
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
37
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
38
# SOFTWARE.
39
+ import test
39
40
40
41
import glob
41
42
import os
43
+ import shlex
42
44
import subprocess
43
45
import sys
44
- import test
45
46
from itertools import zip_longest
46
47
47
48
if os .environ .get ("ENABLE_CPYTHON_TAGGED_UNITTESTS" ) == "true" or __name__ == "__main__" :
@@ -106,7 +107,7 @@ def test_tagged(max_patterns=100):
106
107
else :
107
108
rcode = run_with_timeout (cmd ).returncode
108
109
if rcode :
109
- raise CalledProcessError (rcode , cmd )
110
+ raise subprocess . CalledProcessError (rcode , cmd )
110
111
print (working_test [0 ], "was finished." )
111
112
112
113
def run_serialize_out (cmd ):
@@ -175,7 +176,7 @@ def parse_unittest_output(output):
175
176
# The whole reason for this function's complexity is that we want to consume arbitrary
176
177
# warnings after the '...' part without accidentally consuming the next test result
177
178
import re
178
- re_test_result = re .compile (r"""\b(test\S+) \(([^\s] +)\)(?:\n.*?)?? \.\.\. """ , re .MULTILINE | re .DOTALL )
179
+ re_test_result = re .compile (r"""\b(test\S+) \((\S +)\)(?:\n.*?)?? \.\.\. """ , re .MULTILINE | re .DOTALL )
179
180
re_test_status = re .compile (r"""\b(ok|skipped (?:'[^']*'|"[^"]*")|FAIL|ERROR)$""" , re .MULTILINE | re .DOTALL )
180
181
pos = 0
181
182
current_result = None
@@ -241,7 +242,7 @@ def main():
241
242
else :
242
243
testfile_stem = os .path .splitext (os .path .basename (testfile ))[0 ]
243
244
testmod = "test." + testfile_stem
244
- cmd = executable
245
+ cmd = list ( executable )
245
246
if repeat == 0 :
246
247
# Allow catching Java exceptions in the first iteration only, so that subsequent iterations
247
248
# (there will be one even if everything succeeds) filter out possible false-passes caused by
@@ -264,7 +265,7 @@ def main():
264
265
cmd += ["-k" , selector ]
265
266
cmd .append (testfile )
266
267
267
- print (" " .join (cmd ))
268
+ print (shlex .join (cmd ))
268
269
p = run_with_timeout (cmd , errors = 'backslashreplace' , ** kwargs )
269
270
print ("*stdout*" )
270
271
print (p .stdout )
@@ -273,7 +274,7 @@ def main():
273
274
274
275
if p .returncode == - 9 :
275
276
print (
276
- f"\n Timeout (return code -9)\n you can try to increase the current timeout { tout } s by using --timeout=NNN" )
277
+ f"\n Timeout (return code -9)\n you can try to increase the current timeout { TIMEOUT } s by using --timeout=NNN" )
277
278
278
279
passing_tests = set ()
279
280
failing_tests = set ()
0 commit comments