test_cli: make timers more reliable

A slow Travis-CI host caused one the 1.0s KEY_TIMER to fire by accident,
making the test fail because it wasn't expecting to see the "please be
patient" message. Fixed this by increasing the timeout to a very large value
when we aren't explicitly testing it.
This commit is contained in:
Brian Warner 2017-12-19 13:41:05 -08:00
parent c7c7c0381c
commit 67253bde55

View File

@ -530,7 +530,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
) as mrx_tm:
receive_d = cmd_receive.receive(recv_cfg)
else:
KEY_TIMER = 0 if mode == "slow-sender-text" else 1.0
KEY_TIMER = 0 if mode == "slow-sender-text" else 99999
rxw = []
with mock.patch.object(cmd_receive, "KEY_TIMER", KEY_TIMER):
send_d = cmd_send.send(send_cfg)
@ -544,7 +544,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
# The sender might fail, leaving the receiver hanging, or vice
# versa. Make sure we don't wait on one side exclusively
VERIFY_TIMER = 0 if mode == "slow-text" else 1.0
VERIFY_TIMER = 0 if mode == "slow-text" else 99999
with mock.patch.object(cmd_receive, "VERIFY_TIMER", VERIFY_TIMER):
with mock.patch.object(cmd_send, "VERIFY_TIMER", VERIFY_TIMER):
if mock_accept: