def test_ddc_project_addition(minimal_project, mocker, capsys): from derex.runner import hookimpl class CustomAdditional: @staticmethod @hookimpl def ddc_project_options( project: Project, ) -> Dict[str, Union[str, List[str]]]: """See derex.runner.plugin_spec.ddc_project_options docstring """ return { "options": ["custom-additional"], "name": "custom", "priority": ">local-derex", } with minimal_project: docker_compose_path = Project().root / "docker-compose.yml" with docker_compose_path.open("w") as fh: fh.write("lms:\n image: foobar\n") project = Project() run_ddc_project([], project, dry_run=True) output = capsys.readouterr().out # The last option should be the path of the user docker compose file for this project assert output.endswith(f"-f {docker_compose_path}\n")
def test_docker_compose_addition_per_runmode(minimal_project, mocker, capsys): with minimal_project: docker_compose_debug_path = Project().root / "docker-compose-debug.yml" with docker_compose_debug_path.open("w") as fh: fh.write("lms:\n image: foobar\n") project = Project() run_ddc_project([], project, dry_run=True) output = capsys.readouterr().out # The last option should be the path of the debug docker compose assert output.endswith(f"-f {docker_compose_debug_path}\n") project.runmode = ProjectRunMode.production default_project_docker_compose_file = project.private_filepath( "docker-compose.yml") run_ddc_project([], project, dry_run=True) output = capsys.readouterr().out # The last option should be the path of the project default docker compose file assert output.endswith(f"-f {default_project_docker_compose_file}\n")