Code

fix unit test compatibility
authorrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 13 Mar 2009 03:31:30 +0000 (03:31 +0000)
committerrichard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2>
Fri, 13 Mar 2009 03:31:30 +0000 (03:31 +0000)
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/roundup/trunk@4194 57a73879-2fb5-44c3-a270-3262357dd7e2

test/db_test_base.py
test/test_indexer.py

index 241fd9528e067f8c4368c3c55a0ed864fec4307c..ce3d2ee8c39609d948c500932ca20910abac1a3e 100644 (file)
@@ -1793,7 +1793,7 @@ class DBTest(MyTestCase):
                 messages = [m], nosy = [db.user.lookup("fred")])
 
             db.issue.nosymessage(i, m, {})
-            mail_msg = res["mail_msg"].getvalue()
+            mail_msg = str(res["mail_msg"])
             self.assertEqual(res["mail_to"], ["fred@example.com"])
             self.failUnless("From: admin" in mail_msg)
             self.failUnless("Subject: [issue1] spam" in mail_msg)
index 4a3369e7fa4c9f154d1d8167f816370ea3ff618d..319536d609c3198d1ebb906f8f85df80504ff8d5 100644 (file)
@@ -48,14 +48,14 @@ class IndexerTest(unittest.TestCase):
         self.dex.load_index()
 
     def assertSeqEqual(self, s1, s2):
-        # first argument is the db result we're testing, second is the
-        # desired result some db results don't have iterable rows, so we
-        # have to work around that
+        # First argument is the db result we're testing, second is the
+        # desired result. Some db results don't have iterable rows, so we
+        # have to work around that.
         # Also work around some dbs not returning items in the expected
-        # order. This would be *so* much easier with python2.4's sorted.
-        s1 = list(s1)
+        # order.
+        s1 = list([tuple([r[n] for n in range(len(r))]) for r in s1])
         s1.sort()
-        if [i for x,y in zip(s1, s2) for i,j in enumerate(y) if x[i] != j]:
+        if s1 != s2:
             self.fail('contents of %r != %r'%(s1, s2))
 
     def test_basics(self):