Skip to content

Commit 233f237

Browse files
committed
run tests that are packages
1 parent 9fb61fa commit 233f237

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ def fun(self):
9292
cmd.extend(["-k", testpattern])
9393
testmod = working_test[0].rpartition(".")[2]
9494
print("Running test:", working_test[0])
95-
cmd.append(os.path.join(os.path.dirname(test.__file__), "%s.py" % testmod))
95+
testfile = os.path.join(os.path.dirname(test.__file__), "%s.py" % testmod)
96+
if not os.path.isfile(testfile):
97+
testfile = os.path.join(os.path.dirname(test.__file__), "%s/__init__.py" % testmod)
98+
cmd.append(testfile)
9699
subprocess.check_call(cmd)
97100
print(working_test[0], "was finished.")
98101

@@ -156,6 +159,8 @@ def parse_unittest_output(output):
156159
timeout = p.stdout.strip()
157160

158161
testfiles = glob.glob(glob_pattern)
162+
testfiles += glob.glob(glob_pattern.replace(".py", "/__init__.py"))
163+
159164
for idx, testfile in enumerate(testfiles):
160165
for repeat in range(maxrepeats):
161166
# we always do this multiple times, because sometimes the tagging
@@ -164,7 +169,10 @@ def parse_unittest_output(output):
164169
# use the tags and if it fails in the last run, we assume something
165170
# sad is happening and delete the tags file to skip the tests
166171
# entirely
167-
testfile_stem = os.path.splitext(os.path.basename(testfile))[0]
172+
if testfile.endswith("__init__.py"):
173+
testfile_stem = os.path.basename(os.path.dirname(testfile))
174+
else:
175+
testfile_stem = os.path.splitext(os.path.basename(testfile))[0]
168176
testmod = "test." + testfile_stem
169177
cmd = [timeout, "-s", "9", "120"] + executable
170178
if repeat == 0:

0 commit comments

Comments
 (0)