micropython/tests/io/open_append.py
Jim Mussared 4216bc7d13 tests: Replace umodule with module everywhere.
This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-06-08 17:54:24 +10:00

35 lines
461 B
Python

import os
if not hasattr(os, "remove"):
print("SKIP")
raise SystemExit
# cleanup in case testfile exists
try:
os.remove("testfile")
except OSError:
pass
# Should create a file
f = open("testfile", "a")
f.write("foo")
f.close()
f = open("testfile")
print(f.read())
f.close()
f = open("testfile", "a")
f.write("bar")
f.close()
f = open("testfile")
print(f.read())
f.close()
# cleanup
try:
os.remove("testfile")
except OSError:
pass