diff options
author | Damien George <damien@micropython.org> | 2023-11-20 23:04:55 +1100 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2024-02-07 13:25:09 +1100 |
commit | b87bbaeb43ddbd603b6ac3266ccc15815198b5a7 (patch) | |
tree | 768abedede5042051967a9e73d6354619a4acd71 /tests/extmod/vfs_fat_mtime.py | |
parent | 5804aa020452c9fe115c53ce9514b442945832bb (diff) | |
download | micropython-b87bbaeb43ddbd603b6ac3266ccc15815198b5a7.tar.gz micropython-b87bbaeb43ddbd603b6ac3266ccc15815198b5a7.zip |
tests: Use vfs module instead of os.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'tests/extmod/vfs_fat_mtime.py')
-rw-r--r-- | tests/extmod/vfs_fat_mtime.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/extmod/vfs_fat_mtime.py b/tests/extmod/vfs_fat_mtime.py index 1ceb611364..0c7e10a548 100644 --- a/tests/extmod/vfs_fat_mtime.py +++ b/tests/extmod/vfs_fat_mtime.py @@ -1,11 +1,11 @@ # Test for VfsFat using a RAM device, mtime feature try: - import time, os + import time, os, vfs time.time time.sleep - os.VfsFat + vfs.VfsFat except (ImportError, AttributeError): print("SKIP") raise SystemExit @@ -41,21 +41,21 @@ def test(bdev, vfs_class): vfs_class.mkfs(bdev) # construction - vfs = vfs_class(bdev) + fs = vfs_class(bdev) # Create an empty file, should have a timestamp. current_time = int(time.time()) - vfs.open("test1", "wt").close() + fs.open("test1", "wt").close() # Wait 2 seconds so mtime will increase (FAT has 2 second resolution). time.sleep(2) # Create another empty file, should have a timestamp. - vfs.open("test2", "wt").close() + fs.open("test2", "wt").close() # Stat the files and check mtime is non-zero. - stat1 = vfs.stat("test1") - stat2 = vfs.stat("test2") + stat1 = fs.stat("test1") + stat2 = fs.stat("test2") print(stat1[8] != 0, stat2[8] != 0) # Check that test1 has mtime which matches time.time() at point of creation. @@ -67,8 +67,8 @@ def test(bdev, vfs_class): print(stat1[8] < stat2[8]) # Unmount. - vfs.umount() + fs.umount() bdev = RAMBlockDevice(50) -test(bdev, os.VfsFat) +test(bdev, vfs.VfsFat) |