Skip to content

Commit a50effd

Browse files
committed
Fix bugs in test_tagged_unittests
1 parent c89507d commit a50effd

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

graalpython/com.oracle.graal.python.test/src/tests/test_tagged_unittests.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3737
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
3838
# SOFTWARE.
39+
import test
3940

4041
import glob
4142
import os
43+
import shlex
4244
import subprocess
4345
import sys
44-
import test
4546
from itertools import zip_longest
4647

4748
if os.environ.get("ENABLE_CPYTHON_TAGGED_UNITTESTS") == "true" or __name__ == "__main__":
@@ -106,7 +107,7 @@ def test_tagged(max_patterns=100):
106107
else:
107108
rcode = run_with_timeout(cmd).returncode
108109
if rcode:
109-
raise CalledProcessError(rcode, cmd)
110+
raise subprocess.CalledProcessError(rcode, cmd)
110111
print(working_test[0], "was finished.")
111112

112113
def run_serialize_out(cmd):
@@ -175,7 +176,7 @@ def parse_unittest_output(output):
175176
# The whole reason for this function's complexity is that we want to consume arbitrary
176177
# warnings after the '...' part without accidentally consuming the next test result
177178
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)
179180
re_test_status = re.compile(r"""\b(ok|skipped (?:'[^']*'|"[^"]*")|FAIL|ERROR)$""", re.MULTILINE | re.DOTALL)
180181
pos = 0
181182
current_result = None
@@ -241,7 +242,7 @@ def main():
241242
else:
242243
testfile_stem = os.path.splitext(os.path.basename(testfile))[0]
243244
testmod = "test." + testfile_stem
244-
cmd = executable
245+
cmd = list(executable)
245246
if repeat == 0:
246247
# Allow catching Java exceptions in the first iteration only, so that subsequent iterations
247248
# (there will be one even if everything succeeds) filter out possible false-passes caused by
@@ -264,7 +265,7 @@ def main():
264265
cmd += ["-k", selector]
265266
cmd.append(testfile)
266267

267-
print(" ".join(cmd))
268+
print(shlex.join(cmd))
268269
p = run_with_timeout(cmd, errors='backslashreplace', **kwargs)
269270
print("*stdout*")
270271
print(p.stdout)
@@ -273,7 +274,7 @@ def main():
273274

274275
if p.returncode == -9:
275276
print(
276-
f"\nTimeout (return code -9)\nyou can try to increase the current timeout {tout}s by using --timeout=NNN")
277+
f"\nTimeout (return code -9)\nyou can try to increase the current timeout {TIMEOUT}s by using --timeout=NNN")
277278

278279
passing_tests = set()
279280
failing_tests = set()

0 commit comments

Comments
 (0)