[PATCH] Fixes test_dates break in older version of Python
Menno Smits <menno-jZ/TYErj1jVWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.python.db.psycopg.devel |
|---|---|
| Message-ID | <[email protected]> |
There's a couple of test failures with Python 2.4 and older in test_dates.py. This is because exceptions don't have a message attribute before Python 2.5. The attached patch fixes that by using str instead. Regards, Menno _______________________________________________ Psycopg mailing list Psycopg-IAPFreCvJWPBWskQ1e/[email protected] http://lists.initd.org/mailman/listinfo/psycopg
python24-test_dates.patch
(text/x-patch, 2.2 KB)
diff -Naur psycopg2-2.0.9-orig/tests/test_dates.py psycopg2-2.0.9-date_failure/tests/test_dates.py
--- psycopg2-2.0.9-orig/tests/test_dates.py 2009-04-01 19:32:51.928228739 +0100
+++ psycopg2-2.0.9-date_failure/tests/test_dates.py 2009-04-01 19:34:29.251790957 +0100
@@ -131,7 +131,7 @@
try:
self.check_time_tz("+01:15:42", 4542)
except ValueError, exc:
- self.assertEqual(exc.message, "time zone offset 4542 is not a "
+ self.assertEqual(str(exc), "time zone offset 4542 is not a "
"whole number of minutes")
else:
self.fail("Expected ValueError")
@@ -139,7 +139,7 @@
try:
self.check_time_tz("-01:15:42", -4542)
except ValueError, exc:
- self.assertEqual(exc.message, "time zone offset -4542 is not a "
+ self.assertEqual(str(exc), "time zone offset -4542 is not a "
"whole number of minutes")
else:
self.fail("Expected ValueError")
@@ -175,7 +175,7 @@
try:
self.check_datetime_tz("+01:15:42", 4542)
except ValueError, exc:
- self.assertEqual(exc.message, "time zone offset 4542 is not a "
+ self.assertEqual(str(exc), "time zone offset 4542 is not a "
"whole number of minutes")
else:
self.fail("Expected ValueError")
@@ -183,7 +183,7 @@
try:
self.check_datetime_tz("-01:15:42", -4542)
except ValueError, exc:
- self.assertEqual(exc.message, "time zone offset -4542 is not a "
+ self.assertEqual(str(exc), "time zone offset -4542 is not a "
"whole number of minutes")
else:
self.fail("Expected ValueError")
diff -Naur psycopg2-2.0.9-orig/tests/test_lobject.py psycopg2-2.0.9-date_failure/tests/test_lobject.py
--- psycopg2-2.0.9-orig/tests/test_lobject.py 2009-04-01 19:26:46.741883301 +0100
+++ psycopg2-2.0.9-date_failure/tests/test_lobject.py 2008-05-06 22:55:34.000000000 +0100
@@ -26,7 +26,6 @@
pass
else:
lo.unlink()
- self.conn.close()
def test_create(self):
lo = self.conn.lobject()