Skip to content

test_day and test_day_without_date failures #241

@s-t-e-v-e-n-k

Description

@s-t-e-v-e-n-k

While debugging a build failure for openSUSE, I discovered test_day and test_day_without_date failed in tests/test_managers.py due to the timezone falling through to America/Chicago and therefore not matching any records.

Overriding the settings as in other tests in that file fixed the failure:

--- django-request.orig/tests/test_managers.py
+++ django-request/tests/test_managers.py
@@ -134,12 +134,14 @@ class RequestQuerySetTest(TestCase):
         qs = Request.objects.all().week(year='foo', week='1')
         self.assertIsNone(qs)
 
+    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
     def test_day(self):
         qs = Request.objects.all().day(date=now())
         self.assertEqual(1, qs.count())
         qs = Request.objects.all().day(date=now() - timedelta(days=3))
         self.assertEqual(0, qs.count())
 
+    @override_settings(USE_TZ=True, TIME_ZONE='Africa/Nairobi')
     def test_day_without_date(self):
         qs = Request.objects.all().day(
             year=str(now().year),

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions