Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit80cd32a

Browse files
committed
tests/run-tests.py: Set name of injected test module to '__main__'.
Signed-off-by: Damien George <damien@micropython.org>
1 parentee8d8b3 commit80cd32a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎tests/run-tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,13 @@ def base_path(*p):
5959
os.environ["PYTHONIOENCODING"]="utf-8"
6060

6161
# Code to allow a target MicroPython to import an .mpy from RAM
62+
# Note: the module is named `__injected_test` but it needs to have `__name__` set to `__main__`
63+
# so that the test thinks it is the main module, eg so unittest works.
6264
injected_import_hook_code="""\
6365
import sys, os, io, vfs
6466
class __File(io.IOBase):
6567
def __init__(self):
68+
sys.modules['__injected_test'].__name__ = '__main__'
6669
self.off = 0
6770
def ioctl(self, request, arg):
6871
return 0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp