summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/extmod/vfs_userfs.py7
-rw-r--r--tests/extmod/vfs_userfs.py.exp5
2 files changed, 12 insertions, 0 deletions
diff --git a/tests/extmod/vfs_userfs.py b/tests/extmod/vfs_userfs.py
index 518373c70..91c355c3d 100644
--- a/tests/extmod/vfs_userfs.py
+++ b/tests/extmod/vfs_userfs.py
@@ -68,6 +68,7 @@ user_files = {
"/data.txt": b"some data in a text file",
"/usermod1.py": b"print('in usermod1')\nimport usermod2",
"/usermod2.py": b"print('in usermod2')",
+ "/usermod3.py": b"syntax error",
}
os.mount(UserFS(user_files), "/userfs")
@@ -79,6 +80,12 @@ print(f.read())
sys.path.append("/userfs")
import usermod1
+# import a .py file with a syntax error (file should be closed on error)
+try:
+ import usermod3
+except SyntaxError:
+ print("SyntaxError in usermod3")
+
# unmount and undo path addition
os.umount("/userfs")
sys.path.pop()
diff --git a/tests/extmod/vfs_userfs.py.exp b/tests/extmod/vfs_userfs.py.exp
index 00ddd95fc..be54da47c 100644
--- a/tests/extmod/vfs_userfs.py.exp
+++ b/tests/extmod/vfs_userfs.py.exp
@@ -10,3 +10,8 @@ stat /usermod2.py
open /usermod2.py rb
ioctl 4 0
in usermod2
+stat /usermod3
+stat /usermod3.py
+open /usermod3.py rb
+ioctl 4 0
+SyntaxError in usermod3