Skip to content

Commit

Permalink
tests/run-multitests: Make paths more deterministic.
Browse files Browse the repository at this point in the history
Allows running from a different directory, etc.

This work was funded by Planet Innovation.
  • Loading branch information
pi-anl authored and dpgeorge committed Sep 19, 2022
1 parent 7589d86 commit 13c4470
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions tests/run-multitests.py
Expand Up @@ -15,15 +15,24 @@
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")
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 13c4470

Please sign in to comment.