def test_remove_raise_error_if_pth_is_dir(): assert_raises(OSError, lambda: remove(pj(tmp_dir, "tree/subdir")))
def test_remove_actually_remove_file(): pth = pj(tmp_dir, "tree", "doofus0.txt") assert os.path.exists(pth) remove(pth) assert not os.path.exists(pth)
def test_remove_raise_error_if_file_do_not_exists(): assert_raises(OSError, lambda: remove("tutu.titi"))
from sys import argv from oaserver.oa_server_file import OAServerFile from oaserver.uos import ls, remove from ip_list import dirac_com_dir as com_dir if len(argv) == 1: sid = "doofus" else: port = int(argv[1]) sid = "doofus_%d" % port local_com_dir = com_dir + "/" + sid stdin = "dirac:%s/stdin" % local_com_dir stdout = "dirac:%s/stdout" % local_com_dir for name in ls(stdin): remove(stdin + "/" + name) #################################################################### # # launch oaserver # #################################################################### oas = OAServerFile(sid, stdin) oas.register(stdout + "/reg.json") oas.start()