From dae9dfd889c9d49f0e1a0715e35a71b86bab1af3 Mon Sep 17 00:00:00 2001 From: Simone Robutti Date: Fri, 4 Mar 2022 10:55:38 +0100 Subject: [PATCH] set timezone to CUT --- tests/commands/test_list.py | 8 ++++---- tests/conftest.py | 2 +- tests/formatting/test_output_format.py | 13 ++----------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/tests/commands/test_list.py b/tests/commands/test_list.py index 2716311..3574443 100644 --- a/tests/commands/test_list.py +++ b/tests/commands/test_list.py @@ -28,11 +28,11 @@ async def test_list_events(capsys, generate_models): output = capsys.readouterr() assert clean_output(output) == [ "event_0 WAITING 00000000-0000-0000-0000-000000000000" - " 2021-06-06T05:00:00+02:00 2021-06-06T07:00:00+02:00", + " 2021-06-06T03:00:00+00:00 2021-06-06T05:00:00+00:00", "event_1 COMPLETED 00000000-0000-0000-0000-000000000001" - " 2021-06-07T05:00:00+02:00 2021-06-07T07:00:00+02:00", + " 2021-06-07T03:00:00+00:00 2021-06-07T05:00:00+00:00", "event_2 FAILED 00000000-0000-0000-0000-000000000002" - " 2021-06-08T05:00:00+02:00 2021-06-08T07:00:00+02:00", + " 2021-06-08T03:00:00+00:00 2021-06-08T05:00:00+00:00", ] @@ -43,7 +43,7 @@ async def test_list_events_with_status(capsys, generate_models): output = capsys.readouterr() assert clean_output(output) == [ "event_0 WAITING 00000000-0000-0000-0000-000000000000" - " 2021-06-06T05:00:00+02:00 2021-06-06T07:00:00+02:00" + " 2021-06-06T03:00:00+00:00 2021-06-06T05:00:00+00:00" ] diff --git a/tests/conftest.py b/tests/conftest.py index 442e112..ae3933a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -39,7 +39,7 @@ def generate_publication_status(published): @pytest.fixture(autouse=True) def set_timezone(): - os.environ["TZ"] = "Europe/Rome" + os.environ["TZ"] = "Coordinated Universal Time" time.tzset() diff --git a/tests/formatting/test_output_format.py b/tests/formatting/test_output_format.py index 563cbbe..d903c4b 100644 --- a/tests/formatting/test_output_format.py +++ b/tests/formatting/test_output_format.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta, timezone +from datetime import datetime from uuid import UUID import arrow @@ -7,16 +7,7 @@ import pytest from mobilizon_reshare.event.event import MobilizonEvent from mobilizon_reshare.publishers.platforms.platform_mapping import get_formatter_class -begin_date = arrow.get( - datetime( - year=2021, - month=1, - day=1, - hour=11, - minute=30, - tzinfo=timezone(timedelta(hours=1)), - ) -).to("local") +begin_date = arrow.get(datetime(year=2021, month=1, day=1, hour=11, minute=30,)) end_date = begin_date.shift(hours=1)