Andrew Godwin avatar Andrew Godwin committed eabd02a Merge

Merged in charettes/south/fix-skipunless-python-lt-2.6 (pull request #58)

Comments (0)

Files changed (2)

south/tests/__init__.py

     # skipUnless added in Python 2.7;
     from unittest import skipUnless
 except ImportError:
-    try: 
-        # django.utils.unittest added in Django 1.3;
-        from django.utils.unittest import skipUnless
-    except ImportError:
-        def skipUnless(condition, message):
-            def decorator(testfunc):
-                @wraps(testfunc)
-                def wrapper(self):
-                    if condition:
-                        # Apply method
-                        testfunc(self)
-                    else:
-                        # The skip exceptions are not available either...
-                        print "Skipping", testfunc.__name__,"--", message
-                return wrapper
-            return decorator
+    def skipUnless(condition, message):
+        def decorator(testfunc):
+            @wraps(testfunc)
+            def wrapper(self):
+                if condition:
+                    # Apply method
+                    testfunc(self)
+                else:
+                    # The skip exceptions are not available either...
+                    print "Skipping", testfunc.__name__,"--", message
+            return wrapper
+        return decorator
 
 
 # Try importing all tests if asked for (then we can run 'em)

south/tests/inspector.py

-from south.tests import Monkeypatcher
-from south.modelsinspector import *
+
+from south.tests import Monkeypatcher, skipUnless
+from south.modelsinspector import (convert_on_delete_handler, get_value,
+    IsDefault, models, value_clean)
+
 from fakeapp.models import HorribleModel, get_sentinel_object
 
-from django.utils.functional import wraps
 
 on_delete_is_available = hasattr(models, "PROTECT") # models here is django.db.models
-
-from south.tests import skipUnless        
 skipUnlessOnDeleteAvailable = skipUnless(on_delete_is_available, "not testing on_delete -- not available on Django<1.3")                    
 
-
 class TestModelInspector(Monkeypatcher):
 
     """
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.