summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/run-natmodtests.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/run-natmodtests.py b/tests/run-natmodtests.py
index 9fe970a6d..16f8fde96 100755
--- a/tests/run-natmodtests.py
+++ b/tests/run-natmodtests.py
@@ -46,14 +46,14 @@ class __FS:
def chdir(self, path):
pass
def stat(self, path):
- if path == '__injected.mpy':
+ if path == '/__injected.mpy':
return tuple(0 for _ in range(10))
else:
raise OSError(-2) # ENOENT
def open(self, path, mode):
return __File()
os.mount(__FS(), '/__remote')
-os.chdir('/__remote')
+sys.path.insert(0, '/__remote')
sys.modules['{}'] = __import__('__injected')
"""
@@ -111,9 +111,10 @@ def run_tests(target_truth, target, args, stats):
test_file_data = f.read()
# Create full test with embedded .mpy
+ test_script = b"import sys\nsys.path.remove('')\n\n"
try:
with open(NATMOD_EXAMPLE_DIR + test_mpy, "rb") as f:
- test_script = b"__buf=" + bytes(repr(f.read()), "ascii") + b"\n"
+ test_script += b"__buf=" + bytes(repr(f.read()), "ascii") + b"\n"
except OSError:
print("---- {} - mpy file not compiled".format(test_file))
continue