def test_remove_directory(self): directory_path = os.path.join(os.path.dirname(__file__), 'test_remove_command_dir') PathUtil.mkdir_if_not_exists(directory_path) command2 = RemoveCommand(directory_path) command2.execute() self.assertFalse(os.path.exists(directory_path))
def test_copy_directory(self): source_directory_path = os.path.join(TEST_DATA_PATH, 'test_copy_command_directory') destination_directory_path = os.path.join( TEST_DATA_PATH, 'test_copy_command_dest_directory') PathUtil.mkdir_if_not_exists(source_directory_path) command = CopyCommand(source_directory_path, destination_directory_path) command.execute() self.assertTrue(os.path.exists(destination_directory_path))
def __init__(self, *args, **kwargs): ShareParameter.batch_name = self.__class__.__name__ logging.config.dictConfig( YamlUtil.load_file(PathUtil.logging_conf_path())) logger = logging.getLogger('jetline') logger.info('start') super(BaseTestCase, self).__init__(*args, **kwargs)
from jetline.util.path_util import PathUtil from jetline.util.yaml_util import YamlUtil from jetline.share_parameter.share_parameter import ShareParameter if __name__ == '__main__': exit_code = ShareParameter.error_return_code module = None logger = None try: exec_yaml_path, exec_date, working_dir = Module.parse_kick_args(sys.argv[1:]) if working_dir is not None: os.chdir(working_dir) batch_name, ext = os.path.splitext(os.path.basename(exec_yaml_path)) ShareParameter.batch_name = batch_name logging.config.dictConfig(YamlUtil.load_file(PathUtil.logging_conf_path())) logger = logging.getLogger('jetline') logger.info('module kicked...') logger.info('exec yaml: ' + exec_yaml_path) logger.info('exec_date: ' + exec_date) module = Module(exec_yaml_path, exec_date) module.set_up() module.execute() exit_code = ShareParameter.success_return_code except Exception as e: logger.exception(e) exit_code = ShareParameter.error_return_code finally: if module is not None: module.tear_down() if logger is not None:
def test_logger_yaml_path(self): logging_conf_path = PathUtil.logging_conf_path() self.assertTrue(os.path.exists(logging_conf_path))
def test_all_component_yaml_path(self): component_path = PathUtil.component_path() self.assertTrue(os.path.exists(component_path))
def test_settings_root_path(self): settings_root_path = PathUtil.settings_root_path() self.assertTrue(os.path.exists(settings_root_path))
def test_framework_root_path(self): jetline_root_path = PathUtil.jetline_root_path() self.assertTrue(os.path.exists(jetline_root_path))
def setUpClass(cls) -> None: PathUtil.mkdir_if_not_exists(TEST_DATA_PATH)