Skip to content

Commit e2820b4

Browse files
committed
[GR-59302] Fix downstream issues in tests
PullRequest: graalpython/3575
2 parents 1b62a61 + 30be93b commit e2820b4

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

graalpython/com.oracle.graal.python.test/src/runner.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@
6666
from textwrap import dedent
6767

6868
DIR = Path(__file__).parent.resolve()
69+
GRAALPYTHON_DIR = DIR.parent.parent.resolve()
6970
UNIT_TEST_ROOT = (DIR / 'tests').resolve()
70-
TAGGED_TEST_ROOT = (DIR.parent.parent / 'lib-python' / '3' / 'test').resolve()
71+
TAGGED_TEST_ROOT = (GRAALPYTHON_DIR / 'lib-python' / '3' / 'test').resolve()
7172
IS_GRAALPY = sys.implementation.name == 'graalpy'
7273

7374

@@ -1197,7 +1198,7 @@ def main():
11971198
args.failfast = True
11981199

11991200
if IS_GRAALPY:
1200-
if get_bool_env('GRAALPYTEST_ALLOW_NO_JAVA_ASSERTIONS'):
1201+
if not get_bool_env('GRAALPYTEST_ALLOW_NO_JAVA_ASSERTIONS'):
12011202
# noinspection PyUnresolvedReferences
12021203
if not __graalpython__.java_assert():
12031204
sys.exit(
@@ -1206,13 +1207,13 @@ def main():
12061207
if not hasattr(__graalpython__, 'tdebug'):
12071208
sys.exit("Needs to be run with --experimental-options --python.EnableDebuggingBuiltins\n")
12081209

1209-
implicit_root = (TAGGED_TEST_ROOT if args.tagged else UNIT_TEST_ROOT).relative_to(Path('.').resolve())
1210+
implicit_root = Path(os.path.relpath(TAGGED_TEST_ROOT if args.tagged else UNIT_TEST_ROOT))
12101211
for i, test in enumerate(args.tests):
1211-
if not test.test_file.is_absolute() and not test.test_file.resolve().is_relative_to(DIR.parent.parent):
1212+
if not test.test_file.is_absolute() and not test.test_file.resolve().is_relative_to(GRAALPYTHON_DIR):
12121213
args.tests[i] = test.with_test_file(implicit_root / test.test_file)
12131214
for i, ignore in enumerate(args.ignore):
12141215
ignore_path = Path(ignore)
1215-
if not ignore_path.is_absolute() and not ignore_path.resolve().is_relative_to(DIR.parent.parent):
1216+
if not ignore_path.is_absolute() and not ignore_path.resolve().is_relative_to(GRAALPYTHON_DIR):
12161217
args.ignore[i] = implicit_root / ignore_path
12171218

12181219
partial = None

mx.graalpython/mx_graalpython.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,10 +1107,13 @@ def is_included(path):
11071107

11081108
def run_python_unittests(python_binary, args=None, paths=None, exclude=None, env=None,
11091109
use_pytest=False, cwd=None, lock=None, out=None, err=None, nonZeroIsFatal=True, timeout=None,
1110-
report=False, parallel=1, runner_args=None):
1110+
report=False, parallel=None, runner_args=None):
11111111
if lock:
11121112
lock.acquire()
11131113

1114+
if parallel is None:
1115+
parallel = 6 if paths is None else 1
1116+
11141117
args = args or []
11151118
args = [
11161119
"--vm.ea",
@@ -1167,7 +1170,7 @@ def run_python_unittests(python_binary, args=None, paths=None, exclude=None, env
11671170
if paths is not None:
11681171
args += paths
11691172
else:
1170-
args.append(os.path.relpath(SUITE.dir))
1173+
args.append(os.path.relpath(_python_unittest_root()))
11711174

11721175
mx.logv(shlex.join([python_binary] + args))
11731176
if lock:
@@ -1289,7 +1292,7 @@ def run_tagged_unittests(python_binary, env=None, cwd=None, nonZeroIsFatal=True,
12891292
run_python_unittests(
12901293
python_binary,
12911294
runner_args=['--tagged', *runner_args],
1292-
paths=[os.path.relpath(SUITE.dir)],
1295+
paths=[os.path.relpath(os.path.join(_get_stdlib_home(), 'test'))],
12931296
env=sub_env,
12941297
cwd=cwd,
12951298
nonZeroIsFatal=nonZeroIsFatal,
@@ -1388,19 +1391,19 @@ def graalpython_gate_runner(args, tasks):
13881391

13891392
with Task('GraalPython sandboxed tests', tasks, tags=[GraalPythonTags.unittest_sandboxed]) as task:
13901393
if task:
1391-
run_python_unittests(graalpy_standalone_jvm_enterprise(), args=SANDBOXED_OPTIONS, report=report(), parallel=6)
1394+
run_python_unittests(graalpy_standalone_jvm_enterprise(), args=SANDBOXED_OPTIONS, report=report())
13921395

13931396
with Task('GraalPython multi-context unittests', tasks, tags=[GraalPythonTags.unittest_multi]) as task:
13941397
if task:
1395-
run_python_unittests(graalpy_standalone_jvm(), args=["-multi-context"], nonZeroIsFatal=nonZeroIsFatal, parallel=6, report=report())
1398+
run_python_unittests(graalpy_standalone_jvm(), args=["-multi-context"], nonZeroIsFatal=nonZeroIsFatal, report=report())
13961399

13971400
with Task('GraalPython Jython emulation tests', tasks, tags=[GraalPythonTags.unittest_jython]) as task:
13981401
if task:
13991402
run_python_unittests(graalpy_standalone_jvm(), args=["--python.EmulateJython"], paths=["test_interop.py"], report=report(), nonZeroIsFatal=nonZeroIsFatal)
14001403

14011404
with Task('GraalPython with Arrow Storage Strategy', tasks, tags=[GraalPythonTags.unittest_arrow]) as task:
14021405
if task:
1403-
run_python_unittests(graalpy_standalone_jvm(), args=["--python.UseNativePrimitiveStorageStrategy"], parallel=6, report=report(), nonZeroIsFatal=nonZeroIsFatal)
1406+
run_python_unittests(graalpy_standalone_jvm(), args=["--python.UseNativePrimitiveStorageStrategy"], report=report(), nonZeroIsFatal=nonZeroIsFatal)
14041407

14051408
with Task('GraalPython HPy tests', tasks, tags=[GraalPythonTags.unittest_hpy]) as task:
14061409
if task:
@@ -2561,7 +2564,7 @@ def python_coverage(args):
25612564
elif kwds.pop("hpy", False):
25622565
run_hpy_unittests(executable, env=env, nonZeroIsFatal=False, timeout=5*60*60) # hpy unittests are really slow under coverage
25632566
else:
2564-
run_python_unittests(executable, env=env, nonZeroIsFatal=False, timeout=3600, parallel=6, **kwds) # pylint: disable=unexpected-keyword-arg;
2567+
run_python_unittests(executable, env=env, nonZeroIsFatal=False, timeout=3600, **kwds) # pylint: disable=unexpected-keyword-arg;
25652568

25662569
# generate a synthetic lcov file that includes all sources with 0
25672570
# coverage. this is to ensure all sources actuall show up - otherwise,

0 commit comments

Comments
 (0)