Code

Ticket #18321: django-ticket18321.diff

File django-ticket18321.diff, 3.6 KB (added by manfre, 2 years ago)
Line 
1diff --git a/tests/regressiontests/generic_views/dates.py b/tests/regressiontests/generic_views/dates.py
2index 98c089f..b4690c1 100644
3--- a/tests/regressiontests/generic_views/dates.py
4+++ b/tests/regressiontests/generic_views/dates.py
5@@ -3,9 +3,10 @@ from __future__ import absolute_import
6 import datetime
7 
8 from django.core.exceptions import ImproperlyConfigured
9+from django.db import connection
10 from django.test import TestCase
11 from django.test.utils import override_settings
12-from django.utils import timezone
13+from django.utils import timezone, unittest
14 
15 from .models import Book, BookSigning
16 
17@@ -95,6 +96,8 @@ class ArchiveIndexViewTests(TestCase):
18         res = self.client.get('/dates/booksignings/')
19         self.assertEqual(res.status_code, 200)
20 
21+    @unittest.skipIf(not connection.features.supports_timezones,
22+        "Database backend does not support timezones")
23     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
24     def test_aware_datetime_archive_view(self):
25         BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
26@@ -160,6 +163,8 @@ class YearArchiveViewTests(TestCase):
27         res = self.client.get('/dates/booksignings/2008/')
28         self.assertEqual(res.status_code, 200)
29 
30+    @unittest.skipIf(not connection.features.supports_timezones,
31+        "Database backend does not support timezones")
32     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
33     def test_aware_datetime_year_view(self):
34         BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
35@@ -278,6 +283,8 @@ class MonthArchiveViewTests(TestCase):
36         res = self.client.get('/dates/booksignings/2008/apr/')
37         self.assertEqual(res.status_code, 200)
38 
39+    @unittest.skipIf(not connection.features.supports_timezones,
40+        "Database backend does not support timezones")
41     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
42     def test_aware_datetime_month_view(self):
43         BookSigning.objects.create(event_date=datetime.datetime(2008, 2, 1, 12, 0, tzinfo=timezone.utc))
44@@ -377,6 +384,8 @@ class WeekArchiveViewTests(TestCase):
45         res = self.client.get('/dates/booksignings/2008/week/13/')
46         self.assertEqual(res.status_code, 200)
47 
48+    @unittest.skipIf(not connection.features.supports_timezones,
49+        "Database backend does not support timezones")
50     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
51     def test_aware_datetime_week_view(self):
52         BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
53@@ -477,6 +486,8 @@ class DayArchiveViewTests(TestCase):
54         res = self.client.get('/dates/booksignings/2008/apr/2/')
55         self.assertEqual(res.status_code, 200)
56 
57+    @unittest.skipIf(not connection.features.supports_timezones,
58+        "Database backend does not support timezones")
59     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
60     def test_aware_datetime_day_view(self):
61         bs = BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))
62@@ -553,6 +564,8 @@ class DateDetailViewTests(TestCase):
63         res = self.client.get('/dates/booksignings/2008/apr/2/%d/' % bs.pk)
64         self.assertEqual(res.status_code, 200)
65 
66+    @unittest.skipIf(not connection.features.supports_timezones,
67+        "Database backend does not support timezones")
68     @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
69     def test_aware_datetime_date_detail(self):
70         bs = BookSigning.objects.create(event_date=datetime.datetime(2008, 4, 2, 12, 0, tzinfo=timezone.utc))