Skip to content

Commit c892297

Browse files
committed
make pylint happy, run json parsing tests as style gate
1 parent 2b1ec8e commit c892297

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,6 +1366,7 @@ def update_import_cmd(args):
13661366

13671367
def python_style_checks(args):
13681368
"Check (and fix where possible) copyrights, eclipse formatting, and spotbugs"
1369+
python_run_mx_filetests(args)
13691370
python_checkcopyrights(["--fix"] if "--fix" in args else [])
13701371
if not os.environ.get("ECLIPSE_EXE"):
13711372
find_eclipse()
@@ -1399,6 +1400,13 @@ def python_checkcopyrights(args):
13991400
_python_checkpatchfiles()
14001401

14011402

1403+
def python_run_mx_filetests(args):
1404+
for test in glob.glob(os.path.join(os.path.dirname(__file__), "test_*.py")):
1405+
if not test.endswith("data.py"):
1406+
mx.log(test)
1407+
mx.run([sys.executable, test, "-v"])
1408+
1409+
14021410
def _python_checkpatchfiles():
14031411
listfilename = tempfile.mktemp()
14041412
# additionally, we want to check if the packages we are patching all have a permissive license

mx.graalpython/mx_graalpython_python_benchmarks.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
from os.path import join, abspath, exists
5252

5353

54+
SUITE = None
55+
python_vm_registry = None
56+
57+
5458
class PyPerfJsonRule(mx_benchmark.Rule):
5559
"""Parses a JSON file produced by PyPerf and creates a measurement result."""
5660

@@ -59,8 +63,6 @@ def __init__(self, filename: str, suiteName: str):
5963
self.suiteName = suiteName
6064

6165
def parse(self, text: str) -> dict:
62-
import statistics
63-
6466
r = []
6567
with open(self._prepend_working_dir(self.filename)) as fp:
6668
js = json.load(fp)
@@ -188,8 +190,6 @@ def __init__(self, filename: str, suiteName: str):
188190
self.suiteName = suiteName
189191

190192
def parse(self, text: str) -> dict:
191-
import statistics
192-
193193
r = []
194194
with open(self._prepend_working_dir(self.filename)) as fp:
195195
js = json.load(fp)
@@ -543,7 +543,8 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs):
543543
def register_python_benchmarks():
544544
global python_vm_registry, SUITE
545545

546-
from mx_graalpython_benchmark import python_vm_registry
546+
from mx_graalpython_benchmark import python_vm_registry as vm_registry
547+
python_vm_registry = vm_registry
547548

548549
SUITE = mx.suite("graalpython")
549550

0 commit comments

Comments
 (0)