File tree Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Expand file tree Collapse file tree 3 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -7,16 +7,16 @@ testcontainers-core
7
7
8
8
.. autoclass :: testcontainers.core.image.DockerImage
9
9
10
- Conjoint usage:
10
+ .. autoclass :: testcontainers.core.generic.CustomContainer
11
+
12
+ Using `DockerContainer ` and `DockerImage ` directly:
11
13
12
14
.. doctest ::
15
+
13
16
>>> from testcontainers.core.container import DockerContainer
14
17
>>> from testcontainers.core.waiting_utils import wait_for_logs
15
18
>>> from testcontainers.core.image import DockerImage
16
19
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()
Original file line number Diff line number Diff line change @@ -84,16 +84,16 @@ def _transfer_seed(self) -> None:
84
84
85
85
class CustomContainer (DockerContainer ):
86
86
"""
87
- Custom image container .
87
+ Container based on a custom Docker image .
88
88
89
89
Example:
90
90
91
91
.. doctest::
92
92
93
93
>>> from testcontainers.core.generic import CustomContainer
94
94
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 ()
97
97
98
98
:param path: Path to the Dockerfile to build the image
99
99
:param tag: Tag for the image to be built (default: None)
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ class DockerImage:
16
16
Basic image object to build Docker images.
17
17
18
18
.. doctest::
19
- >>> from testcontainers.core.image import DockerImage
20
19
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:
22
22
... logs = image.get_logs()
23
23
24
24
:param tag: Tag for the image to be built (default: None)
You can’t perform that action at this time.
0 commit comments