diff options
author | Damien George <damien.p.george@gmail.com> | 2019-12-27 12:20:15 +1100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-12-27 12:30:51 +1100 |
commit | 99a04b8060864bb80e6443d601342595f23ea7c4 (patch) | |
tree | 5463baf92e7532cda1ea591eaa8d0f1ecfbe4a44 /tests/extmod/vfs_fat_fileio1.py | |
parent | 865827ed8e423cd89309b8bdd45a13902de56c4e (diff) |
tests/extmod: Split out VfsFat finaliser tests to separate test file.
It tests independent functionality and may need to be skipped for a given
port.
Diffstat (limited to 'tests/extmod/vfs_fat_fileio1.py')
-rw-r--r-- | tests/extmod/vfs_fat_fileio1.py | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/tests/extmod/vfs_fat_fileio1.py b/tests/extmod/vfs_fat_fileio1.py index d0a5e4b73..7fe040d53 100644 --- a/tests/extmod/vfs_fat_fileio1.py +++ b/tests/extmod/vfs_fat_fileio1.py @@ -109,29 +109,3 @@ except OSError as e: vfs.remove("foo_file.txt") print(list(vfs.ilistdir())) - -# Here we test that opening a file with the heap locked fails correctly. This -# is a special case because file objects use a finaliser and allocating with a -# finaliser is a different path to normal allocation. It would be better to -# test this in the core tests but there are no core objects that use finaliser. -import micropython -micropython.heap_lock() -try: - vfs.open('x', 'r') -except MemoryError: - print('MemoryError') -micropython.heap_unlock() - -# Here we test that the finaliser is actually called during a garbage collection. -import gc -N = 4 -for i in range(N): - n = 'x%d' % i - f = vfs.open(n, 'w') - f.write(n) - f = None # release f without closing - [0, 1, 2, 3] # use up Python stack so f is really gone -gc.collect() # should finalise all N files by closing them -for i in range(N): - with vfs.open('x%d' % i, 'r') as f: - print(f.read()) |