Fixed #27830 -- Used distutils.version.LooseVersion for version parsing.

This commit is contained in:
chillaranand 2017-02-15 21:44:21 +05:30 committed by Tim Graham
parent e7dc39fb65
commit 08bda82c23
10 changed files with 52 additions and 45 deletions

View file

@ -323,13 +323,12 @@ class PostgreSQLTests(TestCase):
def test_correct_extraction_psycopg2_version(self):
from django.db.backends.postgresql.base import psycopg2_version
version_path = 'django.db.backends.postgresql.base.Database.__version__'
with mock.patch(version_path, '2.6.9'):
self.assertEqual(psycopg2_version(), (2, 6, 9))
with mock.patch('psycopg2.__version__', '4.2.1 (dt dec pq3 ext lo64)'):
self.assertEqual(psycopg2_version(), (4, 2, 1))
with mock.patch(version_path, '2.5.dev0'):
self.assertEqual(psycopg2_version(), (2, 5))
with mock.patch('psycopg2.__version__', '4.2b0.dev1 (dt dec pq3 ext lo64)'):
self.assertEqual(psycopg2_version(), (4, 2))
class DateQuotingTest(TestCase):