Skip to content

Commit db513f6

Browse files
committed
Add missing, likely failing doctests.
1 parent a1aceac commit db513f6

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

compose/testcontainers/compose/__init__.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,20 @@ class DockerCompose:
2323
2424
.. doctest::
2525
26-
compose_filename = ["docker-compose-1.yml", "docker-compose-2.yml"]
27-
with DockerCompose("/home/project", compose_file_name=compose_file_name, pull=True) as \
28-
compose:
29-
host = compose.get_service_host("hub", 4444)
30-
port = compose.get_service_port("hub", 4444)
31-
driver = webdriver.Remote(
32-
command_executor=(f"http://{host}:{port}/wd/hub"),
33-
desired_capabilities=CHROME,
34-
)
35-
driver.get("http://automation-remarks.com")
36-
stdout, stderr = compose.get_logs()
37-
if stderr:
38-
print(f"Errors\\n:{stderr}")
26+
>>> compose_filename = ["docker-compose-1.yml", "docker-compose-2.yml"]
27+
>>> compose = DockerCompose("/home/project", compose_file_name=compose_file_name,
28+
... pull=True)
29+
... with compose:
30+
... host = compose.get_service_host("hub", 4444)
31+
... port = compose.get_service_port("hub", 4444)
32+
... driver = webdriver.Remote(
33+
... command_executor=(f"http://{host}:{port}/wd/hub"),
34+
... desired_capabilities=CHROME,
35+
... )
36+
... driver.get("http://automation-remarks.com")
37+
... stdout, stderr = compose.get_logs()
38+
... if stderr:
39+
... print(f"Errors\\n:{stderr}")
3940
4041
.. code-block:: yaml
4142

google/testcontainers/google/pubsub.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ class PubSubContainer(DockerContainer):
3030
3131
.. doctest::
3232
33-
def test_docker_run_pubsub():
34-
config = PubSubContainer('google/cloud-sdk:emulators')
35-
with config as pubsub:
36-
publisher = pubsub.get_publisher()
37-
topic_path = publisher.topic_path(pubsub.project, "my-topic")
38-
topic = publisher.create_topic(topic_path)
33+
>>> config = PubSubContainer('google/cloud-sdk:emulators')
34+
>>> with config as pubsub:
35+
... publisher = pubsub.get_publisher()
36+
... topic_path = publisher.topic_path(pubsub.project, "my-topic")
37+
... topic = publisher.create_topic(name=topic_path)
3938
"""
4039
def __init__(self, image: str = "google/cloud-sdk:emulators", project: str = "test-project",
4140
port: int = 8432, **kwargs) -> None:

localstack/testcontainers/localstack/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ class LocalStackContainer(DockerContainer):
3232
The endpoint can be used to create a client with the boto3 library:
3333
.. doctest::
3434
35-
dynamo_client = boto3.client("dynamodb", endpoint_url=dynamo_endpoint)
36-
scan_result = dynamo_client.scan(TableName='foo')
37-
# Do something with the scan result
35+
>>> from testcontainers.localstack import LocalStackContainer
36+
37+
>>> with LocalStackContainer(image="localstack/localstack:0.11.4") as localstack:
38+
... localstack.with_services("dynamodb", "lambda")
39+
... dynamo_endpoint = localstack.get_url()
40+
... dynamo_client = boto3.client("dynamodb", endpoint_url=dynamo_endpoint)
41+
... scan_result = dynamo_client.scan(TableName='foo')
3842
"""
3943
def __init__(self, image: str = 'localstack/localstack:0.11.4', edge_port: int = 4566,
4044
**kwargs) -> None:

0 commit comments

Comments
 (0)