Skip to content

Commit f55ab04

Browse files
committed
Fixed doctest
1 parent 31b0b07 commit f55ab04

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

core/README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ testcontainers-core
77

88
.. autoclass:: testcontainers.core.image.DockerImage
99

10-
Conjoint usage:
10+
.. autoclass:: testcontainers.core.generic.CustomContainer
11+
12+
Using `DockerContainer` and `DockerImage` directly:
1113

1214
.. doctest::
15+
1316
>>> from testcontainers.core.container import DockerContainer
1417
>>> from testcontainers.core.waiting_utils import wait_for_logs
1518
>>> from testcontainers.core.image import DockerImage
1619

17-
>>> with DockerImage(tag="test-image:latest", path=".") as image:
18-
... with DockerContainer(tag=image.tag) as container:
19-
... delay = wait_for_log(container, "Server ready", 60)
20-
21-
Container wrapper for custom image containers:
22-
.. autoclass:: testcontainers.core.generic.CustomContainer
20+
>>> with DockerImage(path="./core/tests/", tag="test-image:latest") as image:
21+
... with DockerContainer(str(image)) as container:
22+
... logs = container.get_logs()

core/testcontainers/core/generic.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,16 @@ def _transfer_seed(self) -> None:
8484

8585
class CustomContainer(DockerContainer):
8686
"""
87-
Custom image container.
87+
Container based on a custom Docker image.
8888
8989
Example:
9090
9191
.. doctest::
9292
9393
>>> from testcontainers.core.generic import CustomContainer
9494
95-
>>> with CustomContainer(tag="my-custom-image:latest", path="/path/to/Dockerfile") as server:
96-
... server_url = server.get_url()
95+
>>> with CustomContainer(path="./core/tests/", tag="my-custom-image:latest") as server:
96+
... logs = server.get_logs()
9797
9898
:param path: Path to the Dockerfile to build the image
9999
:param tag: Tag for the image to be built (default: None)

core/testcontainers/core/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ class DockerImage:
1616
Basic image object to build Docker images.
1717
1818
.. doctest::
19-
>>> from testcontainers.core.image import DockerImage
2019
21-
>>> with DockerImage(path=".", tag="new_image") as image:
20+
>>> from testcontainers.core.image import DockerImage
21+
>>> with DockerImage(path="./core/tests/", tag="test-image") as image:
2222
... logs = image.get_logs()
2323
2424
:param tag: Tag for the image to be built (default: None)

0 commit comments

Comments
 (0)