Skip to content

Commit 8ce7231

Browse files
committed
Add type annotations for mssql.
1 parent e88d2c5 commit 8ce7231

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mssql/testcontainers/mssql/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from os import environ
2-
2+
from typing import Optional
33
from testcontainers.core.generic import DbContainer
44

55

@@ -24,8 +24,9 @@ class SqlServerContainer(DbContainer):
2424
linux-mac/installing-the-microsoft-odbc-driver-for-sql-server>`_.
2525
"""
2626

27-
def __init__(self, image="mcr.microsoft.com/mssql/server:2019-latest", user="SA", password=None,
28-
port=1433, dbname="tempdb", dialect='mssql+pymssql', **kwargs):
27+
def __init__(self, image: str = "mcr.microsoft.com/mssql/server:2019-latest", user: str = "SA",
28+
password: Optional[str] = None, port: int = 1433, dbname: str = "tempdb",
29+
dialect: str = 'mssql+pymssql', **kwargs) -> None:
2930
super(SqlServerContainer, self).__init__(image, **kwargs)
3031

3132
self.port_to_expose = port
@@ -36,13 +37,13 @@ def __init__(self, image="mcr.microsoft.com/mssql/server:2019-latest", user="SA"
3637
self.SQLSERVER_DBNAME = dbname
3738
self.dialect = dialect
3839

39-
def _configure(self):
40+
def _configure(self) -> None:
4041
self.with_env("SA_PASSWORD", self.SQLSERVER_PASSWORD)
4142
self.with_env("SQLSERVER_USER", self.SQLSERVER_USER)
4243
self.with_env("SQLSERVER_DBNAME", self.SQLSERVER_DBNAME)
4344
self.with_env("ACCEPT_EULA", 'Y')
4445

45-
def get_connection_url(self):
46+
def get_connection_url(self) -> str:
4647
return super()._create_connection_url(
4748
dialect=self.dialect, username=self.SQLSERVER_USER, password=self.SQLSERVER_PASSWORD,
4849
db_name=self.SQLSERVER_DBNAME, port=self.port_to_expose

0 commit comments

Comments
 (0)