diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2022-08-18 16:57:45 +1000 |
---|---|---|
committer | Jim Mussared <jim.mussared@gmail.com> | 2023-06-08 17:54:24 +1000 |
commit | 4216bc7d1351feb8199e4ebbff1a9598aa1c5b02 (patch) | |
tree | 5085738ef65ab377c221f290c7fa90ec2acd4d29 /tests/micropython/builtin_execfile.py | |
parent | 5e50975a6dd9466afafbcd012c00078093fe1f57 (diff) |
tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'tests/micropython/builtin_execfile.py')
-rw-r--r-- | tests/micropython/builtin_execfile.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/tests/micropython/builtin_execfile.py b/tests/micropython/builtin_execfile.py index 8a8ce79f7..5a26ccf0a 100644 --- a/tests/micropython/builtin_execfile.py +++ b/tests/micropython/builtin_execfile.py @@ -1,17 +1,17 @@ # Test builtin execfile function using VFS. try: - import uio, uos + import io, os execfile - uio.IOBase - uos.mount + io.IOBase + os.mount except (ImportError, NameError, AttributeError): print("SKIP") raise SystemExit -class File(uio.IOBase): +class File(io.IOBase): def __init__(self, data): self.data = data self.off = 0 @@ -44,21 +44,25 @@ class Filesystem: # First umount any existing mount points the target may have. try: - uos.umount("/") + import io, os + + os.umount("/") except OSError: pass -for path in uos.listdir("/"): - uos.umount("/" + path) +for path in os.listdir("/"): + os.umount("/" + path) # Create and mount the VFS object. files = { "/test.py": "print(123)", } fs = Filesystem(files) -uos.mount(fs, "/test_mnt") +os.mount(fs, "/test_mnt") # Test execfile with a file that doesn't exist. try: + import io, os + execfile("/test_mnt/noexist.py") except OSError: print("OSError") @@ -67,4 +71,4 @@ except OSError: execfile("/test_mnt/test.py") # Unmount the VFS object. -uos.umount(fs) +os.umount(fs) |