summaryrefslogtreecommitdiff
path: root/tests/extmod/vfs_posix.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/extmod/vfs_posix.py')
-rw-r--r--tests/extmod/vfs_posix.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/extmod/vfs_posix.py b/tests/extmod/vfs_posix.py
index ebbd08a4a..bc4c7c201 100644
--- a/tests/extmod/vfs_posix.py
+++ b/tests/extmod/vfs_posix.py
@@ -88,6 +88,9 @@ print(os.listdir(temp_dir))
# construct new VfsPosix with path argument
vfs = os.VfsPosix(temp_dir)
+# when VfsPosix is used the intended way via os.mount(), it can only be called
+# with relative paths when the CWD is inside or at its root, so simulate that
+os.chdir(temp_dir)
print(list(i[0] for i in vfs.ilistdir(".")))
# stat, statvfs (statvfs may not exist)
@@ -112,6 +115,9 @@ vfs.remove("/subdir/micropy_test_dir/test2")
vfs.rmdir("/subdir/micropy_test_dir")
vfs.rmdir("/subdir")
+# done with vfs, restore CWD
+os.chdir(curdir)
+
# remove
os.remove(temp_dir + "/test2")
print(os.listdir(temp_dir))