1 """PPU test utilities"""
6 from tempfile import mkdtemp
16 os.chdir(os.sep) # To the root of the FS
17 shutil.rmtree(tmp_dir)
20 def find_in_path(name):
21 for path in os.environ["PATH"].split(os.pathsep):
22 path = path.strip('"')
23 test_prog_path = os.path.join(path, name)
24 if os.path.exists(test_prog_path):
28 def create_files(files, subdirectory=None):
30 os.makedirs(subdirectory)
34 with open(os.path.join(subdirectory, fname), 'w'):
38 def assert_files_exist(files):
39 if isinstance(files, str):
42 assert os.path.exists(fname)
45 def assert_files_not_exist(files):
46 if isinstance(files, str):
49 assert not os.path.exists(fname)