diff --git a/.github/workflows/test-and-deploy.yml b/.github/workflows/test-and-deploy.yml index 2d8a54ae6..0c3682ce3 100644 --- a/.github/workflows/test-and-deploy.yml +++ b/.github/workflows/test-and-deploy.yml @@ -18,13 +18,17 @@ jobs: check-latest: true cache: npm - name: Install prerequisites - run: make prereqs + run: | + make prereqs + python3 -m pip install numba - name: Run checks run: | npm run lint-check npm run test npm run ts-check python3 ./etc/scripts/util/propscheck.py + python3 ./etc/scripts/util/propschecktest.py + python3 ./etc/scripts/test_numba_wrapper.py - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/etc/scripts/test_numba_wrapper.py b/etc/scripts/test_numba_wrapper.py index 6e47fe499..4efbef044 100644 --- a/etc/scripts/test_numba_wrapper.py +++ b/etc/scripts/test_numba_wrapper.py @@ -30,11 +30,10 @@ import os import sys import unittest import unittest.mock - +import tempfile import numba -from numba.core.caching import tempfile -from . import numba_wrapper +import numba_wrapper class TestMain(unittest.TestCase): @@ -188,3 +187,6 @@ class TestOpenOrStdout(unittest.TestCase): def test_stdout(self) -> None: with numba_wrapper._open_or_stdout(None) as file_: self.assertIs(file_, sys.stdout) + +if __name__ == "__main__": + unittest.main() diff --git a/etc/scripts/util/propscheck.py b/etc/scripts/util/propscheck.py index 7e9b242f3..7182e060d 100644 --- a/etc/scripts/util/propscheck.py +++ b/etc/scripts/util/propscheck.py @@ -27,6 +27,7 @@ from os import listdir from os.path import isfile, join import re import argparse +from argparse import Namespace parser = argparse.ArgumentParser(description='Checks for incorrect/suspicious properties.') parser.add_argument ('--check-suspicious-in-default-prop', required=False, action="store_true") @@ -101,7 +102,7 @@ def check_suspicious_path_and_add(line: Line, m, s): s.add(Line(line.number, m.group(2))) -def process_file(file: str, args): +def process_file(file: str, args: Namespace): default_compiler = set() listed_groups = set() @@ -270,7 +271,7 @@ def print_issue(name, result): print(f"{name}:\n {sep.join(sorted([str(issue) for issue in result]))}") -def find_orphans(args: dict): +def find_orphans(args: Namespace): folder = args.config_dir result = sorted([(f, r) for (f, r) in process_folder(folder, args) if problems_found(r)], key=lambda x: x[0]) if result: diff --git a/etc/scripts/util/propschecktest.py b/etc/scripts/util/propschecktest.py index e6f665be7..cb9da2f93 100644 --- a/etc/scripts/util/propschecktest.py +++ b/etc/scripts/util/propschecktest.py @@ -1,5 +1,6 @@ -import sys +import argparse import os +import sys import unittest from propscheck import process_file, Line @@ -9,7 +10,8 @@ class PropsCheckTests(unittest.TestCase): def run_test(self, filename, expected_key, expected_contents): base_path = os.path.dirname(os.path.abspath(sys.argv[0])) test_case_file = os.path.join(base_path, 'test', 'cases', f"{filename}.properties") - result = process_file(test_case_file) + args = argparse.Namespace(check_suspicious_in_default_prop=True) + result = process_file(test_case_file, args) self.assertEqual(result[expected_key], {Line(-1, text) for text in expected_contents}) def test_bad_compilers_exe(self): @@ -77,7 +79,8 @@ class PropsCheckTests(unittest.TestCase): def test_good_file(self): base_path = os.path.dirname(os.path.abspath(sys.argv[0])) test_case_file = os.path.join(base_path, '..', '..', 'config', 'c++.amazon.properties') - result = process_file(test_case_file) + args = argparse.Namespace(check_suspicious_in_default_prop=False) + result = process_file(test_case_file, args) for k in result: self.assertEqual(result[k], set(), f"{k} has output in known good file")