We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13b56bf commit a5cd904Copy full SHA for a5cd904
src/pytest_databases/_service.py
@@ -164,7 +164,18 @@ def run(
164
ulimits=ulimits,
165
mem_limit=mem_limit,
166
)
167
- container.reload()
+
168
+ # reload the container; sometimes it can take a while before docker
169
+ # spins it up and the metadata becomes available, so we're redoing the
170
+ # check with a small incremental backup here
171
+ for i in range(10):
172
+ if any(v for v in container.ports.values()):
173
+ break
174
+ container.reload()
175
+ time.sleep(0.1 + (i / 10))
176
+ else:
177
+ msg = f"Service {name!r} failed to create container"
178
+ raise ValueError(msg)
179
180
host_port = int(
181
container.ports[next(k for k in container.ports if k.startswith(str(container_port)))][0]["HostPort"]
0 commit comments