pikapython/test/python/os/os_test1.py
pikastech a3b402ae36 add os module
fix color for GC DUMP

add os module and test

support ESP32
2023-03-15 03:20:25 +00:00

25 lines
407 B
Python

import os
origin = os.getcwd()
os.chdir("test/out")
os.getcwd()
try:
# cleanup
os.remove("_testdir/testfile")
os.rmdir("_testdir")
except:
pass
os.mkdir("_testdir")
os.chdir("_testdir")
f = os.open("testfile", os.O_CREAT | os.O_RDWR)
assert os.write(f, b"Hello World!") == 12
assert os.lseek(f, 0, 0) == 0
print(os.read(f, 100))
os.close(f)
os.chdir("..")
os.chdir(origin)
print("PASS")