tests/extmod/vfs_fat_fileio1: Add test for failing alloc with finaliser.

pull/1/head
Damien George 2018-02-26 13:36:13 +11:00
parent 62be14d77c
commit a604451566
2 changed files with 13 additions and 0 deletions

View File

@ -113,3 +113,15 @@ 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()

View File

@ -11,3 +11,4 @@ o
d
True
[('foo_dir', 16384, 0)]
MemoryError