1 Test case fails: tests/backend/tarantool/test_schema.py::test_drop - AssertionError: assert [] == ['abci_chains...ta_data', ...]

This commit is contained in:
Sangat Das 2022-07-12 01:08:22 -07:00
parent ef8dbff7a5
commit 109f50bec9

View File

@ -20,6 +20,13 @@ BACKENDS = {
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class DBSingleton(type):
_instances = {}
def __call__(cls, *args, **kwargs):
if cls not in cls._instances:
cls._instances[cls] = super(DBSingleton, cls).__call__(*args, **kwargs)
return cls._instances[cls]
def connect(host: str = None, port: int = None, login: str = None, password: str = None, backend: str = None, def connect(host: str = None, port: int = None, login: str = None, password: str = None, backend: str = None,
**kwargs): **kwargs):
@ -81,7 +88,7 @@ def _kwargs_parser(key, kwargs):
return kwargs[key] return kwargs[key]
return None return None
class Connection: class Connection(metaclass=DBSingleton):
"""Connection class interface. """Connection class interface.
All backend implementations should provide a connection class that inherits All backend implementations should provide a connection class that inherits
from and implements this class. from and implements this class.