def test_standard(self): self.assertTrue(os.path.exists('./externals/')) file_list = os.listdir('./externals/') self.assertTrue(len(file_list) > 0) with nostderrout(): remove_dir('./externals/') self.assertFalse(os.path.exists('./externals/'))
def make_links(links_files, links_dir='@DEFAULTVALUE@', makelog='@DEFAULTVALUE@', quiet=False): try: if makelog == '@DEFAULTVALUE@': makelog = metadata.settings['makelog_file'] # Run preliminaries LOGFILE = start_logging(metadata.settings['linkslog_file'], 'make_links.py') list = LinksList(links_files, links_dir) if os.path.exists(list.links_dir): remove_dir(list.links_dir) os.makedirs(list.links_dir) list.issue_sys_command(LOGFILE, quiet) end_logging(LOGFILE, makelog, 'make_links.py') except Exception as errmsg: print("Error with make_links: \n", errmsg)
def tearDown(self): if os.path.isdir('../output/'): shutil.rmtree('../output/') if os.path.isdir('../external/'): shutil.rmtree('../external/') if os.path.isdir('../external_links/'): remove_dir('../external_links/') if os.path.isdir('../cust_data_links/'): remove_dir('../cust_data_links/')
def test_data_links(self): self.assertTrue(os.path.exists('../external_links/externals/')) file_list_dest = os.listdir('../external_links/externals/') file_list_src = os.listdir('./externals/') self.assertTrue(file_list_src == file_list_dest) self.assertTrue(os.path.exists('../external_links/externals/private/')) subdir_file_list_dest = \ os.listdir('../external_links/externals/private/') subdir_file_list_src = os.listdir('./externals/private/') self.assertTrue(subdir_file_list_src == subdir_file_list_dest) with nostderrout(): remove_dir('../external_links') self.assertFalse(os.path.exists('../external_links/')) file_list_src_old = file_list_src file_list_src_new = os.listdir('./externals/') self.assertTrue(file_list_src_old == file_list_src_new)
def tearDown(self): if os.path.isdir('./externals/'): shutil.rmtree('./externals/') if os.path.isdir('../external_links/'): remove_dir('../external_links/')