def setUp(self): self.current_datetime = DateUtils.get_current_datetime() self.patches_basedir = FileUtils.join_path(self.saved_patches_dir, DEST_DIR_PREFIX, self.current_datetime) self.assertIsNotNone(self.patches_basedir) self.assertNotEqual(self.patches_basedir, "~") self.assertNotEqual(self.patches_basedir, "/") self.assertTrue(self.saved_patches_dir in self.patches_basedir) FileUtils.remove_files(self.patches_basedir, FORMAT_PATCH_FILE_PREFIX)
def remove_test_files_and_recreate_dir(cls, dir_name: str, clazz): project_name = cls._validate_project_for_child_dir_creation() cls.validate_test_child_dir(dir_name, project_name) dir_path = cls.CHILD_DIR_TEST_DICT[project_name][dir_name] LOG.info(f"Removing dir: {dir_path}") FileUtils.remove_files(dir_path, ".*") LOG.info(f"Recreating dir: {dir_path}") new_dir = FileUtils.ensure_dir_created(dir_path) LOG.info("Basedir of %s is: %s", clazz.__name__, new_dir) return new_dir