backport stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 30 Sep 2010 15:00:40 +0200
changeset 6370 8c3d6f739fa3
parent 6368 f907cc7f2875 (current diff)
parent 6369 a151453dc564 (diff)
child 6371 9af007a3acb9
backport stable
devtools/testlib.py
server/test/unittest_migractions.py
--- a/devtools/cwwindmill.py	Thu Sep 30 14:58:57 2010 +0200
+++ b/devtools/cwwindmill.py	Thu Sep 30 15:00:40 2010 +0200
@@ -110,5 +110,5 @@
             # try to display a better message in case of failure
             if hasattr(test, "tb"):
                 msg = '\n'.join(test.tb)
-            self.assertEquals(test.result, True, msg=msg)
+            self.assertEqual(test.result, True, msg=msg)
 
--- a/devtools/repotest.py	Thu Sep 30 14:58:57 2010 +0200
+++ b/devtools/repotest.py	Thu Sep 30 15:00:40 2010 +0200
@@ -41,7 +41,7 @@
     plan = self._prepare_plan(rql, kwargs)
     self.planner.build_plan(plan)
     try:
-        self.assertEquals(len(plan.steps), len(expected),
+        self.assertEqual(len(plan.steps), len(expected),
                           'expected %s steps, got %s' % (len(expected), len(plan.steps)))
         # step order is important
         for i, step in enumerate(plan.steps):
@@ -52,20 +52,20 @@
 
 def compare_steps(self, step, expected):
     try:
-        self.assertEquals(step[0], expected[0], 'expected step type %s, got %s' % (expected[0], step[0]))
+        self.assertEqual(step[0], expected[0], 'expected step type %s, got %s' % (expected[0], step[0]))
         if len(step) > 2 and isinstance(step[1], list) and isinstance(expected[1], list):
             queries, equeries = step[1], expected[1]
-            self.assertEquals(len(queries), len(equeries),
+            self.assertEqual(len(queries), len(equeries),
                               'expected %s queries, got %s' % (len(equeries), len(queries)))
             for i, (rql, sol) in enumerate(queries):
-                self.assertEquals(rql, equeries[i][0])
-                self.assertEquals(sorted(sol), sorted(equeries[i][1]))
+                self.assertEqual(rql, equeries[i][0])
+                self.assertEqual(sorted(sol), sorted(equeries[i][1]))
             idx = 2
         else:
             idx = 1
-        self.assertEquals(step[idx:-1], expected[idx:-1],
+        self.assertEqual(step[idx:-1], expected[idx:-1],
                           'expected step characteristic \n%s\n, got\n%s' % (expected[1:-1], step[1:-1]))
-        self.assertEquals(len(step[-1]), len(expected[-1]),
+        self.assertEqual(len(step[-1]), len(expected[-1]),
                           'got %s child steps, expected %s' % (len(step[-1]), len(expected[-1])))
     except AssertionError:
         print 'error on step ',
--- a/devtools/testlib.py	Thu Sep 30 14:58:57 2010 +0200
+++ b/devtools/testlib.py	Thu Sep 30 15:00:40 2010 +0200
@@ -294,7 +294,7 @@
         pause_tracing()
         previous_failure = self.__class__.__dict__.get('_repo_init_failed')
         if previous_failure is not None:
-            self.skip('repository is not initialised: %r' % previous_failure)
+            self.skipTest('repository is not initialised: %r' % previous_failure)
         try:
             self._init_repo()
         except Exception, ex:
@@ -626,18 +626,18 @@
         sh = self.app.session_handler
         path, params = self.expect_redirect(lambda x: self.app.connect(x), req)
         session = req.session
-        self.assertEquals(len(self.open_sessions), nbsessions, self.open_sessions)
-        self.assertEquals(session.login, origsession.login)
-        self.assertEquals(session.anonymous_session, False)
-        self.assertEquals(path, 'view')
-        self.assertEquals(params, {'__message': 'welcome %s !' % req.user.login})
+        self.assertEqual(len(self.open_sessions), nbsessions, self.open_sessions)
+        self.assertEqual(session.login, origsession.login)
+        self.assertEqual(session.anonymous_session, False)
+        self.assertEqual(path, 'view')
+        self.assertEqual(params, {'__message': 'welcome %s !' % req.user.login})
 
     def assertAuthFailure(self, req, nbsessions=0):
         self.app.connect(req)
         self.assertIsInstance(req.session, DBAPISession)
-        self.assertEquals(req.session.cnx, None)
-        self.assertEquals(req.cnx, None)
-        self.assertEquals(len(self.open_sessions), nbsessions)
+        self.assertEqual(req.session.cnx, None)
+        self.assertEqual(req.cnx, None)
+        self.assertEqual(len(self.open_sessions), nbsessions)
         clear_cache(req, 'get_authorization')
 
     # content validation #######################################################
--- a/server/test/unittest_migractions.py	Thu Sep 30 14:58:57 2010 +0200
+++ b/server/test/unittest_migractions.py	Thu Sep 30 15:00:40 2010 +0200
@@ -96,7 +96,7 @@
             if v >= whateverorder:
                 orderdict[k] = v+1
         orderdict['whatever'] = whateverorder
-        self.assertDictEquals(orderdict, orderdict2)
+        self.assertDictEqual(orderdict, orderdict2)
         #self.assertEqual([r.type for r in self.schema['Note'].ordered_relations()],
         #                  ['modification_date', 'creation_date', 'owned_by',
         #                   'eid', 'ecrit_par', 'inline1', 'date', 'type',