Commits

Andrew Godwin committed 68b28db

All tests pass again

Comments (0)

Files changed (4)

     @classmethod
     def for_migration(cls, migration):
         try:
-            return cls.objects.get(app_name=migration.app_name(),
+            return cls.objects.get(app_name=migration.app_label(),
                                    migration=migration.name())
         except cls.DoesNotExist:
-            return cls(app_name=migration.app_name(),
+            return cls(app_name=migration.app_label(),
                        migration=migration.name())
 
     def get_migrations(self):

south/tests/__init__.py

         """
         Changes the Django environment so we can run tests against our test apps.
         """
-        hacks.set_installed_apps(self.installed_apps)
+        if getattr(self, 'installed_apps', None):
+            hacks.set_installed_apps(self.installed_apps)
     
     
     def tearDown(self):
         """
         Undoes what setUp did.
         """
-        hacks.reset_installed_apps()
+        if getattr(self, 'installed_apps', None):
+            hacks.reset_installed_apps()
 
 
 # Try importing all tests if asked for (then we can run 'em)

south/tests/fakeapp/migrations/0001_spam.py

 class Migration:
     
     def forwards(self):
-        
         # Model 'Spam'
         db.create_table("southtest_spam", (
             ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
         ))
     
     def backwards(self):
-        
         db.delete_table("southtest_spam")
 

south/tests/logic.py

             ((u"fakeapp", u"0001_spam"),
              (u"fakeapp", u"0002_eggs"),
              (u"fakeapp", u"0003_alter_spam"),),
-            MigrationHistory.objects.values_list("app_label", "migration"),
+            MigrationHistory.objects.values_list("app_name", "migration"),
         )
         
         # Now roll them backwards