From 6c02da2eec02fc51c74dc6bfb9aeb34428c7a85e Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 6 Jun 2018 13:22:51 +1000 Subject: [PATCH] tests/extmod: Add test for importing a script from a user VFS. --- tests/extmod/vfs_fat_more.py | 8 ++++++++ tests/extmod/vfs_fat_more.py.exp | 1 + 2 files changed, 9 insertions(+) diff --git a/tests/extmod/vfs_fat_more.py b/tests/extmod/vfs_fat_more.py index baec96787b..ae340dde8f 100644 --- a/tests/extmod/vfs_fat_more.py +++ b/tests/extmod/vfs_fat_more.py @@ -114,3 +114,11 @@ uos.umount('/') print(uos.getcwd()) print(uos.listdir()) print(uos.listdir('sys')) + +# test importing a file from a mounted FS +import sys +sys.path.clear() +sys.path.append('/sys') +with open('sys/test_module.py', 'w') as f: + f.write('print("test_module!")') +import test_module diff --git a/tests/extmod/vfs_fat_more.py.exp b/tests/extmod/vfs_fat_more.py.exp index aaca3cc75e..24429ee095 100644 --- a/tests/extmod/vfs_fat_more.py.exp +++ b/tests/extmod/vfs_fat_more.py.exp @@ -26,3 +26,4 @@ mkdir OSError True / ['sys'] [] +test_module!