Skip to content

Commit

Permalink
Remove unneeded pytz package (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
albertyw authored Oct 13, 2022
1 parent b15da76 commit 7ba0a55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions project/tests/test_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from itertools import groupby
from math import floor

import pytz
from django.test import TestCase
from django.utils import timezone

Expand Down Expand Up @@ -148,7 +147,7 @@ def test_after_date_filter_str(self):
date_filter = AfterDateFilter
f = date_filter(dt_str)
new_dt = datetime.strptime(dt_str, fmt)
new_dt = timezone.make_aware(new_dt, pytz.UTC)
new_dt = timezone.make_aware(new_dt, timezone.utc)
self.assertFilter(new_dt, f)


Expand Down Expand Up @@ -177,7 +176,7 @@ def test_before_date_filter_str(self):
date_filter = BeforeDateFilter
f = date_filter(dt_str)
new_dt = datetime.strptime(dt_str, fmt)
new_dt = timezone.make_aware(new_dt, pytz.UTC)
new_dt = timezone.make_aware(new_dt, timezone.utc)
self.assertFilter(new_dt, f)


Expand Down
14 changes: 7 additions & 7 deletions project/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import datetime
import uuid

import pytz
from django.core.management import call_command
from django.test import TestCase, override_settings
from django.utils import timezone
from freezegun import freeze_time

from silk import models
Expand Down Expand Up @@ -45,7 +45,7 @@ def test_uuid_is_primary_key(self):
def test_start_time_field_default(self):

obj = RequestMinFactory.create()
self.assertEqual(obj.start_time, datetime.datetime(2016, 1, 1, 12, 0, 0, tzinfo=pytz.UTC))
self.assertEqual(obj.start_time, datetime.datetime(2016, 1, 1, 12, 0, 0, tzinfo=timezone.utc))

def test_total_meta_time_if_have_no_meta_and_queries_time(self):

Expand Down Expand Up @@ -185,7 +185,7 @@ def test_save_if_have_no_end_time(self):
@freeze_time('2016-01-01 12:00:00')
def test_save_if_have_end_time(self):

date = datetime.datetime(2016, 1, 1, 12, 0, 3, tzinfo=pytz.UTC)
date = datetime.datetime(2016, 1, 1, 12, 0, 3, tzinfo=timezone.utc)
obj = models.Request(path='/some/path/', method='get', end_time=date)
obj.save()
self.assertEqual(obj.end_time, date)
Expand Down Expand Up @@ -262,14 +262,14 @@ class SQLQueryTest(TestCase):
def setUp(self):

self.obj = SQLQueryFactory.create()
self.end_time = datetime.datetime(2016, 1, 1, 12, 0, 5, tzinfo=pytz.UTC)
self.start_time = datetime.datetime(2016, 1, 1, 12, 0, 0, tzinfo=pytz.UTC)
self.end_time = datetime.datetime(2016, 1, 1, 12, 0, 5, tzinfo=timezone.utc)
self.start_time = datetime.datetime(2016, 1, 1, 12, 0, 0, tzinfo=timezone.utc)

@freeze_time('2016-01-01 12:00:00')
def test_start_time_field_default(self):

obj = SQLQueryFactory.create()
self.assertEqual(obj.start_time, datetime.datetime(2016, 1, 1, 12, 0, 0, tzinfo=pytz.UTC))
self.assertEqual(obj.start_time, datetime.datetime(2016, 1, 1, 12, 0, 0, tzinfo=timezone.utc))

def test_is_m2o_related_to_request(self):

Expand Down Expand Up @@ -432,7 +432,7 @@ def test_save_if_no_end_and_start_time(self):
@freeze_time('2016-01-01 12:00:00')
def test_save_if_has_end_time(self):

# datetime.datetime(2016, 1, 1, 12, 0, 5, tzinfo=pytz.UTC)
# datetime.datetime(2016, 1, 1, 12, 0, 5, tzinfo=timezone.utc)
obj = SQLQueryFactory.create(end_time=self.end_time)

self.assertEqual(obj.time_taken, 5000.0)
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
'sqlparse',
'Jinja2',
'autopep8',
'pytz',
'gprof2dot>=2017.09.19',
],
python_requires='>=3.7',
Expand Down

0 comments on commit 7ba0a55

Please sign in to comment.