← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/maas-testfix-assertItemsEqual into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/maas-testfix-assertItemsEqual into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/maas-testfix-assertItemsEqual/+merge/94391

This branch reverts django's assertItemsEqual that break in very weird ways in our test suite.  We simply want to use the default unittest's assertItemsEqual.
-- 
https://code.launchpad.net/~rvb/maas/maas-testfix-assertItemsEqual/+merge/94391
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/maas-testfix-assertItemsEqual into lp:maas.
=== modified file 'src/maastesting/__init__.py'
--- src/maastesting/__init__.py	2012-02-21 13:09:15 +0000
+++ src/maastesting/__init__.py	2012-02-23 15:04:20 +0000
@@ -14,6 +14,8 @@
     'TestModelTestCase',
     ]
 
+import unittest
+
 from django.conf import settings
 from django.core.management import call_command
 from django.db.models import loading
@@ -52,6 +54,10 @@
         testresources.tearDownResources(
             self, self.resources, testresources._get_result())
 
+    def assertItemsEqual(self, expected_seq, actual_seq, msg=None):
+        # Django's implementation for this seems to be broken and was
+        # probably only added to support compatibility with python 2.6.
+        return unittest.TestCase.assertItemsEqual(self, expected_seq, actual_seq, msg)
 
 class TestModelTestCase(TestCase):
     """A custom test case that adds support for test-only models.