diff --git a/kombu/tests/transport/test_sqlalchemy.py b/kombu/tests/transport/test_sqlalchemy.py new file mode 100644 index 00000000..a043b0fc --- /dev/null +++ b/kombu/tests/transport/test_sqlalchemy.py @@ -0,0 +1,24 @@ +from __future__ import absolute_import + +import tempfile + +from kombu.connection import BrokerConnection +from kombu.tests.utils import TestCase + +class test_sqlalchemy(TestCase): + + def test_url_parser(self): + from kombu.transport import sqlalchemy + + tmppath = tempfile.mkdtemp() + + url = "sqlalchemy+sqlite://{path}/celerydb.sqlite".format(path=tmppath) + connection = BrokerConnection(url).connect() + + url = "sqla+sqlite://{path}/celerydb.sqlite".format(path=tmppath) + connection = BrokerConnection(url).connect() + + # Should prevent regression fixed by f187ccd + url = "sqlb+sqlite://{path}/celerydb.sqlite".format(path=tmppath) + with self.assertRaises(KeyError): + BrokerConnection(url).connect() diff --git a/kombu/transport/sqlalchemy/__init__.py b/kombu/transport/sqlalchemy/__init__.py index cb7e4afc..e667c61c 100644 --- a/kombu/transport/sqlalchemy/__init__.py +++ b/kombu/transport/sqlalchemy/__init__.py @@ -7,7 +7,7 @@ from sqlalchemy import create_engine from sqlalchemy.exc import OperationalError from sqlalchemy.orm import sessionmaker -from kombu import virtual +from kombu.transport import virtual from kombu.exceptions import StdChannelError from .models import Queue, Message, metadata