|
1 | 1 | from typing import List
|
| 2 | +import os.path |
2 | 3 | from pathlib import Path
|
3 | 4 | import warnings
|
4 | 5 | from datetime import datetime
|
@@ -100,22 +101,36 @@ def docker_project(self, request):
|
100 | 101 | Returns the project instance, which can be used to start and stop
|
101 | 102 | the Docker containers.
|
102 | 103 | """
|
103 |
| - docker_compose = Path(request.config.getoption("docker_compose")) |
104 | 104 |
|
105 |
| - if docker_compose.is_dir(): |
106 |
| - docker_compose /= "docker-compose.yml" |
| 105 | + compose_files = [] |
107 | 106 |
|
108 |
| - if not docker_compose.is_file(): |
109 |
| - raise ValueError( |
110 |
| - "Unable to find `{docker_compose}` " |
111 |
| - "for integration tests.".format( |
112 |
| - docker_compose=docker_compose.absolute(), |
113 |
| - ), |
114 |
| - ) |
| 107 | + for docker_compose in [Path(f) for f in request.config.getoption("docker_compose").split(',')]: |
| 108 | + if docker_compose.is_dir(): |
| 109 | + docker_compose /= "docker-compose.yml" |
| 110 | + |
| 111 | + if not docker_compose.is_file(): |
| 112 | + raise ValueError( |
| 113 | + "Unable to find `{docker_compose}` " |
| 114 | + "for integration tests.".format( |
| 115 | + docker_compose=docker_compose.absolute(), |
| 116 | + ), |
| 117 | + ) |
| 118 | + |
| 119 | + compose_files.append(docker_compose) |
| 120 | + |
| 121 | + if len(compose_files) > 1: |
| 122 | + # py35 needs strings for os.path functions |
| 123 | + project_dir = os.path.commonpath([str(f) for f in compose_files]) or '.' |
| 124 | + compose_files = [p.relative_to(project_dir) for p in compose_files] |
| 125 | + else: |
| 126 | + project_dir = '.' |
| 127 | + |
| 128 | + # py35 needs strings for os.path functions |
| 129 | + compose_files = map(str, compose_files) |
115 | 130 |
|
116 | 131 | project = project_from_options(
|
117 |
| - project_dir=str(docker_compose.parent), |
118 |
| - options={"--file": [docker_compose.name]}, |
| 132 | + project_dir=str(project_dir), |
| 133 | + options={"--file": compose_files}, |
119 | 134 | )
|
120 | 135 |
|
121 | 136 | if not request.config.getoption("--docker-compose-no-build"):
|
|
0 commit comments