mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
26 lines
423 B
Python
26 lines
423 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)
|
|
os.listdir('.')
|
|
print("PASS")
|