Skip to content

Commit e62dbbd

Browse files
committed
Benchmark harness: allow relative benchmark path with single path component
1 parent 4942be1 commit e62dbbd

File tree

1 file changed

+5
-4
lines changed
  • graalpython/com.oracle.graal.python.benchmarks/python

1 file changed

+5
-4
lines changed

graalpython/com.oracle.graal.python.benchmarks/python/harness.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved.
1+
# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
22
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
33
#
44
# The Universal Permissive License (UPL), Version 1.0
@@ -270,9 +270,10 @@ def get_bench_module(bench_file):
270270
name = bench_file.rpartition(os.sep)[2].partition(".")[0].replace('.py', '')
271271
directory = bench_file.rpartition(os.sep)[0]
272272
pkg = []
273-
while any(f.endswith("__init__.py") for f in os.listdir(directory)):
274-
directory, slash, postfix = directory.rpartition("/")
275-
pkg.insert(0, postfix)
273+
if directory:
274+
while any(f.endswith("__init__.py") for f in os.listdir(directory)):
275+
directory, slash, postfix = directory.rpartition("/")
276+
pkg.insert(0, postfix)
276277

277278
if pkg:
278279
sys.path.insert(0, directory)

0 commit comments

Comments
 (0)