def test_compose_error(arrow_compose_path): compose = DockerCompose(arrow_compose_path, params=dict(PYTHON='3.8', PANDAS='master')) compose.validate() error = subprocess.CalledProcessError(99, []) with mock.patch('subprocess.run', side_effect=error): with pytest.raises(RuntimeError) as exc: compose.run('conda-cpp') exception_message = str(exc.value) assert "exited with a non-zero exit code 99" in exception_message assert "PANDAS: latest" in exception_message assert "export PANDAS=master" in exception_message
def test_config_validation(tmpdir): config_path = create_config(tmpdir, missing_service_compose_yml) compose = DockerCompose(config_path) msg = "`sub-foo` is defined in `x-hierarchy` bot not in `services`" with pytest.raises(ValueError, match=msg): compose.validate() config_path = create_config(tmpdir, missing_node_compose_yml) compose = DockerCompose(config_path) msg = "`sub-bar` is defined in `services` but not in `x-hierarchy`" with pytest.raises(ValueError, match=msg): compose.validate() config_path = create_config(tmpdir, ok_compose_yml) compose = DockerCompose(config_path) compose.validate()
def test_arrow_example_validation_passes(arrow_compose_path): compose = DockerCompose(arrow_compose_path) compose.validate()