From bb0910999e35f2a4aaa0139d3a5737b6bd3d096e Mon Sep 17 00:00:00 2001 From: Christian Decker Date: Mon, 16 Nov 2020 14:28:12 +0100 Subject: [PATCH] pytest: Use datetime.strptime instead of datetime.fromisoformat The latter is available only starting with Python 3.7, and it's the only test that fails with <3.7. This allows us to keep on testing with older versions. --- tests/test_plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 4b07abbd0..d04e28a52 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -694,8 +694,8 @@ def test_channel_state_changed_bilateral(node_factory, bitcoind): assert(event2['message'] == "Lockin complete") # also test the correctness of timestamps once - assert(datetime.fromisoformat(event1['timestamp'].replace('Z', '+00:00'))) - assert(datetime.fromisoformat(event2['timestamp'].replace('Z', '+00:00'))) + assert(datetime.strptime(event1['timestamp'], '%Y-%m-%dT%H:%M:%S.%fZ')) + assert(datetime.strptime(event2['timestamp'], '%Y-%m-%dT%H:%M:%S.%fZ')) # close channel and look for stateful events l1.rpc.close(scid)