tests/run-multitests: Make paths more deterministic.
Allows running from a different directory, etc. This work was funded by Planet Innovation.
This commit is contained in:
parent
7589d86b6b
commit
13c4470fd0
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue