Andrew Godwin avatar Andrew Godwin committed 5067237

Fix timezone-awareness of test suite

Comments (0)

Files changed (1)

south/tests/db.py

     def test_datetime_default(self):
         """
         Test that defaults are created correctly for datetime columns
-        """    
+        """
         from datetime import datetime
 
-        end_of_world = 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)
+
         db.create_table("test_datetime_def", [
             ('col0', models.IntegerField(null=True)),
             ('col1', models.DateTimeField(default=end_of_world)),
             ('col2', models.DateTimeField(null=True)),
         ])
-        db.alter_column("test_datetime_def", "col2", models.DateTimeField(default=end_of_world))        
+        db.alter_column("test_datetime_def", "col2", models.DateTimeField(default=end_of_world))
         db.add_column("test_datetime_def", "col3", models.DateTimeField(default=end_of_world))
         db.execute("insert into test_datetime_def (col0) values (null)")
         ends = db.execute("select col1,col2,col3 from test_datetime_def")[0]
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.