From b605f06b17682ba9d17b55b5d34cc6c6483ac341 Mon Sep 17 00:00:00 2001 From: Paolo Lammens Date: Sun, 17 Feb 2019 14:37:52 +0100 Subject: [PATCH] test: Fix 'test_idle' test This test annoyingly caused all PRs to appear as failed. The cause was the fact that the last message logged isn't the 'Received signal 15' message, but the 'Error while getting Updates: Conflict: terminated by setWebhook request'. --- tests/test_updater.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/test_updater.py b/tests/test_updater.py index b8414cba695..7df4e590408 100644 --- a/tests/test_updater.py +++ b/tests/test_updater.py @@ -334,9 +334,16 @@ def test_idle(self, updater, caplog): with caplog.at_level(logging.INFO): updater.idle() - rec = caplog.records[-1] - assert rec.msg.startswith('Received signal {}'.format(signal.SIGTERM)) - assert rec.levelname == 'INFO' + rec1, rec2 = caplog.records[-1], caplog.records[-2] + + def test1(rec): + return rec.msg.startswith('Received signal {}'.format(signal.SIGTERM)) + + def test2(rec): + return rec.levelname == 'INFO' + + assert test1(rec1) or test1(rec2) + assert test2(rec1) or test2(rec2) # If we get this far, idle() ran through sleep(.5)