File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 14
14
from testcontainers .core .container import DockerContainer
15
15
from testcontainers .core .waiting_utils import wait_container_is_ready
16
16
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
18
23
19
24
20
25
class DbContainer (DockerContainer ):
21
26
def __init__ (self , image , ** kwargs ):
22
27
super (DbContainer , self ).__init__ (image , ** kwargs )
23
28
24
- @wait_container_is_ready (OperationalError )
29
+ @wait_container_is_ready (* ADDITIONAL_TRANSIENT_ERRORS )
25
30
def _connect (self ):
26
31
import sqlalchemy
27
32
engine = sqlalchemy .create_engine (self .get_connection_url ())
You can’t perform that action at this time.
0 commit comments