Andrew Godwin avatar Andrew Godwin committed 811fa5c Merge

Merged in charettes/south/aware-datetime-test-failure (pull request #51)

Comments (0)

Files changed (1)

south/tests/db.py

+import datetime
 import unittest
 
 from south.db import db, generic
         """
         Test that defaults are created correctly for datetime columns
         """
-        from datetime import datetime
+        end_of_world = datetime.datetime(2012, 12, 21, 0, 0, 1)
 
         try:
             from django.utils import timezone
-            end_of_world = datetime(2012, 12, 21, 0, 0, 1, tzinfo=timezone.utc)
         except ImportError:
-            end_of_world = datetime(2012, 12, 21, 0, 0, 1)
+            pass
+        else:
+            from django.conf import settings
+            if getattr(settings, 'USE_TZ', False):
+                end_of_world = end_of_world.replace(tzinfo=timezone.utc)
 
         db.create_table("test_datetime_def", [
             ('col0', models.IntegerField(null=True)),
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.