diff --git a/src/wormhole/cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py index aa7f3a2..1cb457b 100644 --- a/src/wormhole/cli/cmd_receive.py +++ b/src/wormhole/cli/cmd_receive.py @@ -14,8 +14,8 @@ from .welcome import handle_welcome APPID = u"lothar.com/wormhole/text-or-file-xfer" -KEY_TIMER = 1.0 -VERIFY_TIMER = 1.0 +KEY_TIMER = float(os.environ.get("_MAGIC_WORMHOLE_TEST_KEY_TIMER", 1.0)) +VERIFY_TIMER = float(os.environ.get("_MAGIC_WORMHOLE_TEST_VERIFY_TIMER", 1.0)) class RespondError(Exception): def __init__(self, response): diff --git a/src/wormhole/cli/cmd_send.py b/src/wormhole/cli/cmd_send.py index 0e5c4e5..969ab0f 100644 --- a/src/wormhole/cli/cmd_send.py +++ b/src/wormhole/cli/cmd_send.py @@ -13,7 +13,7 @@ from ..util import dict_to_bytes, bytes_to_dict, bytes_to_hexstr from .welcome import handle_welcome APPID = u"lothar.com/wormhole/text-or-file-xfer" -VERIFY_TIMER = 1 +VERIFY_TIMER = float(os.environ.get("_MAGIC_WORMHOLE_TEST_VERIFY_TIMER", 1.0)) def send(args, reactor=reactor): """I implement 'wormhole send'. I return a Deferred that fires with None diff --git a/src/wormhole/test/test_cli.py b/src/wormhole/test/test_cli.py index ca2d405..2ff080e 100644 --- a/src/wormhole/test/test_cli.py +++ b/src/wormhole/test/test_cli.py @@ -468,6 +468,15 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): elif send_cfg.what: content_args = [send_cfg.what] + # raise the rx KEY_TIMER to some large number here, to avoid + # spurious test failures on hosts that are slow enough to trigger + # the "Waiting for sender..." pacifier message. We can do in + # not-as_subprocess, because we can directly patch the value before + # running the receiver. But we can't patch across the subprocess + # boundary, so we use an environment variable. + env = self._env.copy() + env["_MAGIC_WORMHOLE_TEST_KEY_TIMER"] = "999999" + env["_MAGIC_WORMHOLE_TEST_VERIFY_TIMER"] = "999999" send_args = [ '--relay-url', self.relayurl, '--transit-helper', '', @@ -479,7 +488,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): send_d = getProcessOutputAndValue( wormhole_bin, send_args, path=send_dir, - env=self._env, + env=env, ) recv_args = [ '--relay-url', self.relayurl, @@ -495,7 +504,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): receive_d = getProcessOutputAndValue( wormhole_bin, recv_args, path=receive_dir, - env=self._env, + env=env, ) (send_res, receive_res) = yield gatherResults([send_d, receive_d],