Commits

Andrew Godwin committed 8d758a7 Merge

Merged in shaib/south (pull request #92: Fixes to tests and fix to fake migrations)

Comments (0)

Files changed (3)

south/migration/migrators.py

 
 class FakeMigrator(MigratorWrapper):
     def run(self, migration, database):
+        # Don't actually run, just record as if ran
+        self.record(migration, database)
         if self.verbosity:
             print('   (faked)')
 

south/tests/__init__.py

         if hasattr(self, 'installed_apps'):
             hacks.store_app_cache_state()
             hacks.set_installed_apps(self.installed_apps)
+            # Make sure dependencies are calculated for new apps
+            Migrations._dependencies_done = False
 
     def tearDown(self):
         """

south/tests/logic.py

 
 import datetime
 import sys
+try:
+    set # builtin, python >=2.6
+except NameError:
+    from sets import Set as set # in stdlib, python >=2.3
 
 from south import exceptions
 from south.migration import migrate_app
     
     installed_apps = ["fakeapp", "otherfakeapp"]
 
+    def setUp(self):
+        super(TestMigrationLogic, self).setUp()
+        MigrationHistory.objects.all().delete()
+        
     def assertListEqual(self, list1, list2, msg=None):
-        list1 = list(list1)
-        list2 = list(list2)
-        try:
-            list1.sort()
-            list2.sort()
-        except TypeError:
-            # emulate Python 2 behavior in Python 3
-            list1 = sorted(list1, key=id)
-            list2 = sorted(list2, key=id)
+        list1 = set(list1)
+        list2 = set(list2)
         return self.assert_(list1 == list2, "%s is not equal to %s" % (list1, list2))
 
     def test_find_ghost_migrations(self):
         pass
     
     def test_apply_migrations(self):
-        MigrationHistory.objects.all().delete()
         migrations = Migrations("fakeapp")
         
         # We should start with no migrations
     
     
     def test_migration_merge_forwards(self):
-        MigrationHistory.objects.all().delete()
         migrations = Migrations("fakeapp")
         
         # We should start with no migrations