diff --git a/tests/run-tests.py b/tests/run-tests.py index 6fe45707bb6cd..c72178cd760c2 100755 --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -59,10 +59,13 @@ def base_path(*p): os.environ["PYTHONIOENCODING"] = "utf-8" # Code to allow a target MicroPython to import an .mpy from RAM +# Note: the module is named `__injected_test` but it needs to have `__name__` set to +# `__main__` so that the test sees itself as the main module, eg so unittest works. injected_import_hook_code = """\ import sys, os, io, vfs class __File(io.IOBase): def __init__(self): + sys.modules['__injected_test'].__name__ = '__main__' self.off = 0 def ioctl(self, request, arg): return 0
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: