From c122f1531f03b16316fd8532cffd92f65705d56b Mon Sep 17 00:00:00 2001 From: halcy Date: Fri, 18 Nov 2022 00:19:17 +0200 Subject: Maybe fix test TZ issues --- tests/test_timeline.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tests/test_timeline.py') diff --git a/tests/test_timeline.py b/tests/test_timeline.py index 14b7703..bc6728f 100644 --- a/tests/test_timeline.py +++ b/tests/test_timeline.py @@ -82,10 +82,9 @@ def test_min_max_id(api, status): def test_min_max_id_datetimes(api, status): if os.path.exists("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl"): data_dict = pickle.load(open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'rb')) - the_past = data_dict["the_past"] - the_future = data_dict["the_future"] - the_far_future = data_dict["the_far_future"] - print("restoring from dict\n", the_past, the_future, the_far_future) + the_past = datetime.datetime.fromtimestamp(data_dict["the_past"]) + the_future = datetime.datetime.fromtimestamp(data_dict["the_future"]) + the_far_future = datetime.datetime.fromtimestamp(data_dict["the_far_future"]) else: epoch_time = datetime.datetime.now().timestamp() now = datetime.datetime.fromtimestamp(epoch_time) @@ -93,9 +92,9 @@ def test_min_max_id_datetimes(api, status): the_future = now + datetime.timedelta(seconds=20) the_far_future = now + datetime.timedelta(seconds=40) pickle.dump({ - "the_past": the_past, - "the_future": the_future, - "the_far_future": the_far_future, + "the_past": the_past.timestamp(), + "the_future": the_future.timestamp(), + "the_far_future": the_far_future.timestamp(), }, open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'wb')) time.sleep(3) -- cgit v1.2.3