1try:
2    import uos as os
3except ImportError:
4    import os
5
6if not hasattr(os, "remove"):
7    print("SKIP")
8    raise SystemExit
9
10# cleanup in case testfile exists
11try:
12    os.remove("testfile")
13except OSError:
14    pass
15
16# Should create a file
17f = open("testfile", "a")
18f.write("foo")
19f.close()
20
21f = open("testfile")
22print(f.read())
23f.close()
24
25f = open("testfile", "a")
26f.write("bar")
27f.close()
28
29f = open("testfile")
30print(f.read())
31f.close()
32
33# cleanup
34try:
35    os.remove("testfile")
36except OSError:
37    pass
38