Skip to content

Commit f881c80

Browse files
committed
Remove ports_to_expose from Azurite container.
1 parent 3add8cb commit f881c80

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

azurite/testcontainers/azurite/__init__.py

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,43 +12,43 @@
1212
# under the License.
1313
import os
1414
import socket
15-
from typing import Iterable, Optional
15+
from typing import Optional
1616

1717
from testcontainers.core.container import DockerContainer
18+
from testcontainers.core.utils import raise_for_deprecated_parameter
1819
from testcontainers.core.waiting_utils import wait_container_is_ready
1920

2021

2122
class AzuriteContainer(DockerContainer):
2223
"""
23-
The example below spins up an Azurite container and
24-
shows an example to create a Blob service client with the container. The method
25-
:code:`get_connection_string` can be used to create a client for Blob service, Queue service
26-
and Table service.
24+
The example below spins up an Azurite container and
25+
shows an example to create a Blob service client with the container. The method
26+
:code:`get_connection_string` can be used to create a client for Blob service, Queue service
27+
and Table service.
2728
28-
Example:
29+
Example:
2930
30-
.. doctest::
31+
.. doctest::
3132
32-
>>> from testcontainers.azurite import AzuriteContainer
33-
>>> from azure.storage.blob import BlobServiceClient
33+
>>> from testcontainers.azurite import AzuriteContainer
34+
>>> from azure.storage.blob import BlobServiceClient
3435
35-
>>> with AzuriteContainer() as azurite_container:
36-
... connection_string = azurite_container.get_connection_string()
37-
... client = BlobServiceClient.from_connection_string(
38-
... connection_string,
39-
... api_version="2019-12-12"
40-
... )
41-
"""
36+
>>> with AzuriteContainer() as azurite_container:
37+
... connection_string = azurite_container.get_connection_string()
38+
... client = BlobServiceClient.from_connection_string(
39+
... connection_string,
40+
... api_version="2019-12-12"
41+
... )
42+
"""
4243
def __init__(self, image: str = "mcr.microsoft.com/azure-storage/azurite:latest", *,
43-
ports_to_expose: Optional[Iterable[int]] = None, blob_service_port: int = 10_000,
44-
queue_service_port: int = 10_001, table_service_port: int = 10_002,
45-
account_name: Optional[str] = None, account_key: Optional[str] = None, **kwargs) \
44+
blob_service_port: int = 10_000, queue_service_port: int = 10_001,
45+
table_service_port: int = 10_002, account_name: Optional[str] = None,
46+
account_key: Optional[str] = None, **kwargs) \
4647
-> None:
4748
""" Constructs an AzuriteContainer.
4849
4950
Args:
5051
image: Expects an image with tag.
51-
ports_to_expose: List with port numbers to expose.
5252
**kwargs: Keyword arguments passed to super class.
5353
"""
5454
super().__init__(image=image, **kwargs)
@@ -58,13 +58,12 @@ def __init__(self, image: str = "mcr.microsoft.com/azure-storage/azurite:latest"
5858
"AZURITE_ACCOUNT_KEY", "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/"
5959
"K1SZFPTOtr/KBHBeksoGMGw==")
6060

61+
raise_for_deprecated_parameter(kwargs, "ports_to_expose", "container.with_exposed_ports")
6162
self.blob_service_port = blob_service_port
6263
self.queue_service_port = queue_service_port
6364
self.table_service_port = table_service_port
64-
if not ports_to_expose:
65-
ports_to_expose = [blob_service_port, queue_service_port, table_service_port]
6665

67-
self.with_exposed_ports(*ports_to_expose)
66+
self.with_exposed_ports(*blob_service_port, queue_service_port, table_service_port)
6867
self.with_env("AZURITE_ACCOUNTS", f"{self.account_name}:{self.account_key}")
6968

7069
def get_connection_string(self) -> str:

0 commit comments

Comments
 (0)