tests: Use vfs module instead of os.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-11-20 23:04:55 +11:00
parent 5804aa0204
commit b87bbaeb43
34 changed files with 419 additions and 468 deletions

View File

@@ -59,7 +59,7 @@ os.environ["PYTHONIOENCODING"] = "utf-8"
# Code to allow a target MicroPython to import an .mpy from RAM
injected_import_hook_code = """\
import sys, os, io
import sys, os, io, vfs
class __File(io.IOBase):
def __init__(self):
self.off = 0
@@ -83,7 +83,7 @@ class __FS:
raise OSError(-2) # ENOENT
def open(self, path, mode):
return __File()
os.mount(__FS(), '/__vfstest')
vfs.mount(__FS(), '/__vfstest')
os.chdir('/__vfstest')
__import__('__injected_test')
"""