diff options
| author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2022-09-20 08:54:58 +1000 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-09-20 09:07:18 +1000 |
| commit | 13c4470fd04981fce3fd29771e1d973febbe7d60 (patch) | |
| tree | f67bfb161b0bc97c63c289d70a29dae0279a4c01 /tests | |
| parent | 7589d86b6b6ea4232ff5614f3e73565529d4b3bb (diff) | |
tests/run-multitests: Make paths more deterministic.
Allows running from a different directory, etc.
This work was funded by Planet Innovation.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/run-multitests.py | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/run-multitests.py b/tests/run-multitests.py index b5ba83b0a..70bae5947 100755 --- a/tests/run-multitests.py +++ b/tests/run-multitests.py @@ -15,15 +15,24 @@ import itertools import subprocess import tempfile -sys.path.append("../tools") +test_dir = os.path.abspath(os.path.dirname(__file__)) + +if os.path.abspath(sys.path[0]) == test_dir: + # remove the micropython/tests dir from path to avoid + # accidentally importing tests like micropython/const.py + sys.path.pop(0) + +sys.path.insert(0, test_dir + "/../tools") import pyboard if os.name == "nt": CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3.exe") - MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/windows/micropython.exe") + MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", test_dir + "/../ports/windows/micropython.exe") else: CPYTHON3 = os.getenv("MICROPY_CPYTHON3", "python3") - MICROPYTHON = os.getenv("MICROPY_MICROPYTHON", "../ports/unix/build-standard/micropython") + MICROPYTHON = os.getenv( + "MICROPY_MICROPYTHON", test_dir + "/../ports/unix/build-standard/micropython" + ) # For diff'ing test output DIFF = os.getenv("MICROPY_DIFF", "diff -u") @@ -508,7 +517,7 @@ def main(): cmd_args = cmd_parser.parse_args() # clear search path to make sure tests use only builtin modules and those in extmod - os.environ["MICROPYPATH"] = os.pathsep + "../extmod" + os.environ["MICROPYPATH"] = os.pathsep.join(("", ".frozen", "../extmod")) test_files = prepare_test_file_list(cmd_args.files) max_instances = max(t[1] for t in test_files) |
