diff options
author | halcy <halcy@ARARAGI-KUN> | 2022-11-18 00:19:17 +0200 |
---|---|---|
committer | halcy <halcy@ARARAGI-KUN> | 2022-11-18 00:19:17 +0200 |
commit | c122f1531f03b16316fd8532cffd92f65705d56b (patch) | |
tree | 20a4b6f311b4011e4c2ef160c3e70060cb9f05b6 /tests/test_timeline.py | |
parent | d19b7185d8d92a0338352b2c2169a9c3bd339ee8 (diff) | |
download | mastodon.py-c122f1531f03b16316fd8532cffd92f65705d56b.tar.gz |
Maybe fix test TZ issues
Diffstat (limited to 'tests/test_timeline.py')
-rw-r--r-- | tests/test_timeline.py | 13 |
1 files changed, 6 insertions, 7 deletions
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): | |||
82 | def test_min_max_id_datetimes(api, status): | 82 | def test_min_max_id_datetimes(api, status): |
83 | if os.path.exists("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl"): | 83 | if os.path.exists("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl"): |
84 | data_dict = pickle.load(open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'rb')) | 84 | data_dict = pickle.load(open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'rb')) |
85 | the_past = data_dict["the_past"] | 85 | the_past = datetime.datetime.fromtimestamp(data_dict["the_past"]) |
86 | the_future = data_dict["the_future"] | 86 | the_future = datetime.datetime.fromtimestamp(data_dict["the_future"]) |
87 | the_far_future = data_dict["the_far_future"] | 87 | the_far_future = datetime.datetime.fromtimestamp(data_dict["the_far_future"]) |
88 | print("restoring from dict\n", the_past, the_future, the_far_future) | ||
89 | else: | 88 | else: |
90 | epoch_time = datetime.datetime.now().timestamp() | 89 | epoch_time = datetime.datetime.now().timestamp() |
91 | now = datetime.datetime.fromtimestamp(epoch_time) | 90 | now = datetime.datetime.fromtimestamp(epoch_time) |
@@ -93,9 +92,9 @@ def test_min_max_id_datetimes(api, status): | |||
93 | the_future = now + datetime.timedelta(seconds=20) | 92 | the_future = now + datetime.timedelta(seconds=20) |
94 | the_far_future = now + datetime.timedelta(seconds=40) | 93 | the_far_future = now + datetime.timedelta(seconds=40) |
95 | pickle.dump({ | 94 | pickle.dump({ |
96 | "the_past": the_past, | 95 | "the_past": the_past.timestamp(), |
97 | "the_future": the_future, | 96 | "the_future": the_future.timestamp(), |
98 | "the_far_future": the_far_future, | 97 | "the_far_future": the_far_future.timestamp(), |
99 | }, open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'wb')) | 98 | }, open("tests/cassettes/test_min_max_id_datetimes_datetimeobjects.pkl", 'wb')) |
100 | 99 | ||
101 | time.sleep(3) | 100 | time.sleep(3) |