Commits

Aymeric Augustin  committed 62b0c48

Fix tests on Python 3.

south.TestNonManagedIgnored.test_not_modified_auto still fails,
but not when run in isolation.

  • Participants
  • Parent commits a28c70e

Comments (0)

Files changed (4)

File south/creator/freezer.py

     checked_models = checked_models or set()
     depends = set()
     arg_defs, kwarg_defs = modelsinspector.matching_details(field)
-    for attrname, options in arg_defs + kwarg_defs.values():
+    for attrname, options in arg_defs + list(kwarg_defs.values()):
         if options.get("ignore_if_auto_through", False) and auto_through(field):
             continue
         if options.get("is_value", False):

File south/migration/base.py

 
 from collections import deque
 import datetime
+from imp import reload
 import os
 import re
 import sys

File south/migration/utils.py

     stack = deque(stack)
     while stack:
         try:
-            x = stack[0].next()
-        except AttributeError:
+            x = next(stack[0])
+        except TypeError:
             stack[0] = iter(stack[0])
-            x = stack[0].next()
+            x = next(stack[0])
         except StopIteration:
             stack.popleft()
             continue
-        if hasattr(x, '__iter__'):
+        if hasattr(x, '__iter__') and not isinstance(x, str):
             stack.appendleft(x)
         else:
             yield x

File south/tests/logic.py

     def assertListEqual(self, list1, list2, msg=None):
         list1 = list(list1)
         list2 = list(list2)
-        list1.sort()
-        list2.sort()
+        try:
+            list1.sort()
+            list2.sort()
+        except TypeError:
+            # emulate Python 2 behavior in Python 3
+            list1 = sorted(list1, key=id)
+            list2 = sorted(list2, key=id)
         return self.assert_(list1 == list2, "%s is not equal to %s" % (list1, list2))
 
     def test_find_ghost_migrations(self):