def test_ls_list_all_files_in_directory(): res = ls(pj(tmp_dir, "tree")) assert len(res) == 2 assert "doofus0.txt" in res assert "doofus1.txt" in res
def test_ls_do_not_list_directories(): assert "subdir" not in ls(pj(tmp_dir, "tree"))
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()
def test_ls_raise_error_if_pth_is_not_a_directory(): assert_raises(OSError, lambda: ls("takapouet"))
from oaserver.uos import ls com_dir = "/vo.france-grilles.fr/user/j/jchopard" print ls("dirac:%s" % com_dir)