shaib avatar shaib committed 92d90d2

Python3 related fixes in tests

Comments (0)

Files changed (2)

south/exceptions.py

         if self.exc_info:
             self.traceback = ''.join(format_exception(*self.exc_info))
         else:
-            self.traceback = format_exc()
+            try:
+                self.traceback = format_exc()
+            except AttributeError: # Python3 when there is no previous exception
+                self.traceback = None
 
     def __str__(self):
         return ("While loading migration '%(migration)s':\n"

south/tests/autodetection.py

 from south.orm import FakeORM
 from south.v2 import SchemaMigration
 
+try:
+    from django.utils.six.moves import reload_module
+except ImportError:
+    # Older django, no python3 support
+    reload_module = reload
+
 class TestComparison(unittest.TestCase):
     
     """
 
             complete_apps = ['non_managed']
                     
-        from non_managed import models as dummy_import_to_force_loading_models # TODO: Does needing this indicate a bug in MokeyPatcher? 
+        from non_managed import models as dummy_import_to_force_loading_models # TODO: Does needing this indicate a bug in MokeyPatcher?
+        reload_module(dummy_import_to_force_loading_models) # really force... 
         
         migrations = Migrations("non_managed")
         initial_orm = FakeORM(InitialMigration, "non_managed")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.