psycopg2 dialect.
fixed up some of the error messages tailored
in [ticket:2069]
+- postgresql
+ - Fixed the psycopg2_version parsing in the
+ psycopg2 dialect.
+
0.7.0b4
=======
- general
self.use_native_unicode = use_native_unicode
self.supports_unicode_binds = use_native_unicode
if self.dbapi and hasattr(self.dbapi, '__version__'):
- m = re.match(r'(\d+)\.(\d+)\.(\d+)?',
+ m = re.match(r'(\d+)\.(\d+)(?:\.(\d+))?',
self.dbapi.__version__)
if m:
- self.psycopg2_version = tuple(map(int, m.group(1, 2, 3)))
+ self.psycopg2_version = tuple(
+ int(x)
+ for x in m.group(1, 2, 3)
+ if x is not None)
@classmethod
def dbapi(cls):
eq_(testing.db.dialect._get_server_version_info(MockConn(string)),
version)
+ @testing.only_on('postgresql+psycopg2', 'psycopg2-specific feature')
+ def test_psycopg2_version(self):
+ v = testing.db.dialect.psycopg2_version
+ assert testing.db.dialect.dbapi.__version__.\
+ startswith(".".join(str(x) for x in v))
+
@testing.only_on('postgresql+psycopg2', 'psycopg2-specific feature')
def test_notice_logging(self):
log = logging.getLogger('sqlalchemy.dialects.postgresql')