Skip to content

Commit e3fcead

Browse files
Fix dependency regression (fixes #194). (#196)
1 parent 2aefee2 commit e3fcead

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

testcontainers/core/generic.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,19 @@
1414
from testcontainers.core.container import DockerContainer
1515
from testcontainers.core.waiting_utils import wait_container_is_ready
1616
from deprecation import deprecated
17-
from sqlalchemy.exc import OperationalError
17+
ADDITIONAL_TRANSIENT_ERRORS = []
18+
try:
19+
from sqlalchemy.exc import OperationalError
20+
ADDITIONAL_TRANSIENT_ERRORS.append(OperationalError)
21+
except ImportError:
22+
pass
1823

1924

2025
class DbContainer(DockerContainer):
2126
def __init__(self, image, **kwargs):
2227
super(DbContainer, self).__init__(image, **kwargs)
2328

24-
@wait_container_is_ready(OperationalError)
29+
@wait_container_is_ready(*ADDITIONAL_TRANSIENT_ERRORS)
2530
def _connect(self):
2631
import sqlalchemy
2732
engine = sqlalchemy.create_engine(self.get_connection_url())

0 commit comments

Comments
 (0)