2015-06-20 21:02:41 +00:00
|
|
|
import sys
|
|
|
|
try:
|
2015-12-11 22:04:01 +00:00
|
|
|
import uos as os
|
2015-06-20 21:02:41 +00:00
|
|
|
except ImportError:
|
|
|
|
import os
|
|
|
|
|
|
|
|
if not hasattr(os, "unlink"):
|
|
|
|
print("SKIP")
|
|
|
|
sys.exit()
|
|
|
|
|
2015-08-21 07:45:52 +00:00
|
|
|
# cleanup in case testfile exists
|
2015-06-20 21:02:41 +00:00
|
|
|
try:
|
|
|
|
os.unlink("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()
|
2015-08-21 07:45:52 +00:00
|
|
|
|
|
|
|
# cleanup
|
|
|
|
try:
|
|
|
|
os.unlink("testfile")
|
|
|
|
except OSError:
|
|
|
|
pass
|