def test_run_stage_failure_raises_exception_for_failed_setup( setup_bodywork_test_project: Iterable[bool], project_repo_connection_string: str, bodywork_output_dir: Path, ): with raises(BodyworkStageFailure, match='KeyError'): run_stage('stage_5', project_repo_connection_string)
def test_run_stage_writes_subprocess_stdout_to_process_stdout( setup_bodywork_test_project: Iterable[bool], project_repo_connection_string: str, bodywork_output_dir: Path, capfd: CaptureFixture): run_stage('stage_2', project_repo_connection_string) stdout = capfd.readouterr().out assert 'foo' in stdout
def test_run_stage_failure_writes_subprocess_stdout_stderr_to_process_stdout_stderr( setup_bodywork_test_project: Iterable[bool], project_repo_connection_string: str, bodywork_output_dir: Path, capfd: CaptureFixture): try: run_stage('stage_4', project_repo_connection_string) assert False except BodyworkStageFailure: captured_output = capfd.readouterr() stdout = captured_output.out stdrr = captured_output.err assert 'foo' in stdout assert 'this stage has failed' in stdrr
def test_run_stage_without_requirements_install( setup_bodywork_test_project: Iterable[bool], project_repo_connection_string: str, bodywork_output_dir: Path, ): try: run_stage("stage_2", project_repo_connection_string) assert True except Exception: assert False try: with open(bodywork_output_dir / "stage_2_test_file.txt") as f: stage_output = f.read() assert stage_output.find("Hello from stage 2") != -1 except FileNotFoundError: assert False
def test_run_stage_with_arguements( setup_bodywork_test_project: Iterable[bool], project_repo_connection_string: str, bodywork_output_dir: Path, ): try: run_stage("stage_3", project_repo_connection_string) assert True except Exception: assert False try: with open(bodywork_output_dir / "stage_3_test_file.txt") as f: stage_output = f.read() assert stage_output.find("arg1 = Hello World") != -1 assert stage_output.find("arg2 = 1") != -1 except FileNotFoundError: assert False