diff --git a/src/dsmr_consumption/tests/test_services.py b/src/dsmr_consumption/tests/test_services.py index 7f72f33cc..e466c18fd 100644 --- a/src/dsmr_consumption/tests/test_services.py +++ b/src/dsmr_consumption/tests/test_services.py @@ -1,3 +1,4 @@ +import datetime from decimal import Decimal from unittest import mock @@ -76,10 +77,10 @@ def test_processing(self): [ # Asume a one hour backtrack. timezone.make_aware( - timezone.datetime(2015, 11, 10, hour=18), timezone.utc + timezone.datetime(2015, 11, 10, hour=18), datetime.timezone.utc ), timezone.make_aware( - timezone.datetime(2015, 11, 10, hour=19), timezone.utc + timezone.datetime(2015, 11, 10, hour=19), datetime.timezone.utc ), ], ) diff --git a/src/dsmr_datalogger/tests/models/test_reading.py b/src/dsmr_datalogger/tests/models/test_reading.py index c5207d0fb..77e017a2c 100644 --- a/src/dsmr_datalogger/tests/models/test_reading.py +++ b/src/dsmr_datalogger/tests/models/test_reading.py @@ -1,3 +1,4 @@ +import datetime from unittest import mock from django.test import TestCase @@ -10,7 +11,7 @@ class TestDsmrReading(TestCase): @mock.patch("django.utils.timezone.now") def setUp(self, now_mock): now_mock.return_value = timezone.make_aware( - timezone.datetime(2018, 1, 1), timezone=timezone.utc + timezone.datetime(2018, 1, 1), timezone=datetime.timezone.utc ) self.instance = DsmrReading.objects.create( timestamp=timezone.now(), @@ -39,7 +40,7 @@ def test_managers(self): def test_convert_to_local_timezone(self, now_mock): """Test altering the timezone formatting for the timestamps.""" now_mock.return_value = timezone.make_aware( - timezone.datetime(2018, 1, 1), timezone=timezone.utc + timezone.datetime(2018, 1, 1), timezone=datetime.timezone.utc ) self.assertEqual(str(self.instance.timestamp), "2018-01-01 00:00:00+00:00") diff --git a/src/dsmr_mqtt/tests/services/test_consumption.py b/src/dsmr_mqtt/tests/services/test_consumption.py index 2b2c5b013..e21108678 100644 --- a/src/dsmr_mqtt/tests/services/test_consumption.py +++ b/src/dsmr_mqtt/tests/services/test_consumption.py @@ -1,3 +1,4 @@ +import datetime from unittest import mock import json @@ -89,7 +90,7 @@ def test_create_electricity_signal(self, *service_mocks): @mock.patch("django.utils.timezone.now") def test_publish_json_gas_consumption(self, now_mock, queue_message_mock): now_mock.return_value = timezone.make_aware( - timezone.datetime(2020, 1, 1), timezone=timezone.utc + timezone.datetime(2020, 1, 1), timezone=datetime.timezone.utc ) json_settings = consumption.JSONGasConsumptionMQTTSettings.get_solo() gas_consumption = self._create_gas_consumption() @@ -130,7 +131,7 @@ def test_publish_json_gas_consumption(self, now_mock, queue_message_mock): @mock.patch("django.utils.timezone.now") def test_publish_split_topic_gas_consumption(self, now_mock, queue_message_mock): now_mock.return_value = timezone.make_aware( - timezone.datetime(2020, 1, 1), timezone=timezone.utc + timezone.datetime(2020, 1, 1), timezone=datetime.timezone.utc ) split_topic_settings = ( consumption.SplitTopicGasConsumptionMQTTSettings.get_solo() @@ -176,7 +177,7 @@ def test_publish_json_quarter_hour_peak_consumption( self, now_mock, queue_message_mock ): now_mock.return_value = timezone.make_aware( - timezone.datetime(2023, 1, 1), timezone=timezone.utc + timezone.datetime(2023, 1, 1), timezone=datetime.timezone.utc ) json_settings = ( consumption.JSONQuarterHourPeakElectricityConsumptionMQTTSettings.get_solo() @@ -221,7 +222,7 @@ def test_publish_split_topic_quarter_hour_peak_consumption( self, now_mock, queue_message_mock ): now_mock.return_value = timezone.make_aware( - timezone.datetime(2023, 1, 1), timezone=timezone.utc + timezone.datetime(2023, 1, 1), timezone=datetime.timezone.utc ) split_topic_settings = ( consumption.SplitTopicQuarterHourPeakElectricityConsumptionMQTTSettings.get_solo() diff --git a/src/dsmr_mqtt/tests/services/test_telegram.py b/src/dsmr_mqtt/tests/services/test_telegram.py index f82b26ddf..17164bf89 100644 --- a/src/dsmr_mqtt/tests/services/test_telegram.py +++ b/src/dsmr_mqtt/tests/services/test_telegram.py @@ -1,3 +1,4 @@ +import datetime from unittest import mock import json @@ -86,7 +87,7 @@ def test_publish_raw_dsmr_telegram(self, queue_message_mock): @mock.patch("django.utils.timezone.now") def test_publish_json_dsmr_reading(self, now_mock, queue_message_mock): now_mock.return_value = timezone.make_aware( - timezone.datetime(2018, 1, 1), timezone=timezone.utc + timezone.datetime(2018, 1, 1), timezone=datetime.timezone.utc ) json_settings = telegram.JSONTelegramMQTTSettings.get_solo() dsmr_reading = self._create_dsmrreading() @@ -161,7 +162,7 @@ def test_publish_json_dsmr_reading(self, now_mock, queue_message_mock): @mock.patch("django.utils.timezone.now") def test_publish_split_topic_dsmr_reading(self, now_mock, queue_message_mock): now_mock.return_value = timezone.make_aware( - timezone.datetime(2018, 1, 1), timezone=timezone.utc + timezone.datetime(2018, 1, 1), timezone=datetime.timezone.utc ) split_topic_settings = telegram.SplitTopicTelegramMQTTSettings.get_solo() dsmr_reading = self._create_dsmrreading()