def dags_built(test_project_dir_path: Path, expected_workflow_count: int): if not (test_project_dir_path / '.dags').exists(): return False wff = [ workflow_name for workflow_dir, workflow_name in walk_module_files(test_project_dir_path / '.dags') ] workflows_count = sum( 1 for workflow_dir, workflow_name in walk_module_files(test_project_dir_path / '.dags') if 'workflow' in workflow_name ) return workflows_count == expected_workflow_count
def single_dag_for_workflow_exists(self, workflow_id): dags_created = dir_not_empty(TEST_PROJECT_PATH / '.dags') if not dags_created: return False dag_file_path = os.path.join(*next(walk_module_files(TEST_PROJECT_PATH / '.dags'))) with open(dag_file_path, 'r') as f: return workflow_id in f.read()
def dags_contain(test_project_dir_path: Path, substring: str): for module_dir, module_file_name in walk_module_files(test_project_dir_path / '.dags'): with open(os.path.join(module_dir, module_file_name), 'r') as f: content = f.read() if substring not in content: return False return True
def dags_built(test_project_dir_path: Path, expected_workflow_count: int): if not file_exists(test_project_dir_path / '.dags'): return False return sum(1 for workflow_dir, workflow_name in walk_module_files(test_project_dir_path / '.dags') if 'workflow' in workflow_name) == expected_workflow_count