test_scripts: rename mode to be "slow-text"
This commit is contained in:
parent
face9423dd
commit
30af04d245
|
@ -225,7 +225,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
@inlineCallbacks
|
@inlineCallbacks
|
||||||
def _do_test(self, as_subprocess=False,
|
def _do_test(self, as_subprocess=False,
|
||||||
mode="text", addslash=False, override_filename=False):
|
mode="text", addslash=False, override_filename=False):
|
||||||
assert mode in ("text", "file", "directory", "slow")
|
assert mode in ("text", "file", "directory", "slow-text")
|
||||||
send_cfg = config("send")
|
send_cfg = config("send")
|
||||||
recv_cfg = config("receive")
|
recv_cfg = config("receive")
|
||||||
message = "blah blah blah ponies"
|
message = "blah blah blah ponies"
|
||||||
|
@ -244,7 +244,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
receive_dir = self.mktemp()
|
receive_dir = self.mktemp()
|
||||||
os.mkdir(receive_dir)
|
os.mkdir(receive_dir)
|
||||||
|
|
||||||
if mode == "text" or mode == "slow":
|
if mode == "text" or mode == "slow-text":
|
||||||
send_cfg.text = message
|
send_cfg.text = message
|
||||||
|
|
||||||
elif mode == "file":
|
elif mode == "file":
|
||||||
|
@ -348,7 +348,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
|
|
||||||
# The sender might fail, leaving the receiver hanging, or vice
|
# The sender might fail, leaving the receiver hanging, or vice
|
||||||
# versa. Make sure we don't wait on one side exclusively
|
# versa. Make sure we don't wait on one side exclusively
|
||||||
if mode == "slow":
|
if mode == "slow-text":
|
||||||
with mock.patch.object(cmd_send, "VERIFY_TIMER", 0), \
|
with mock.patch.object(cmd_send, "VERIFY_TIMER", 0), \
|
||||||
mock.patch.object(cmd_receive, "VERIFY_TIMER", 0):
|
mock.patch.object(cmd_receive, "VERIFY_TIMER", 0):
|
||||||
yield gatherResults([send_d, receive_d], True)
|
yield gatherResults([send_d, receive_d], True)
|
||||||
|
@ -367,7 +367,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
|
|
||||||
self.maxDiff = None # show full output for assertion failures
|
self.maxDiff = None # show full output for assertion failures
|
||||||
|
|
||||||
if mode != "slow":
|
if mode != "slow-text":
|
||||||
self.failUnlessEqual(send_stderr, "",
|
self.failUnlessEqual(send_stderr, "",
|
||||||
(send_stdout, send_stderr))
|
(send_stdout, send_stderr))
|
||||||
self.failUnlessEqual(receive_stderr, "",
|
self.failUnlessEqual(receive_stderr, "",
|
||||||
|
@ -381,7 +381,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
(receive_stdout, receive_stderr))
|
(receive_stdout, receive_stderr))
|
||||||
|
|
||||||
# check sender
|
# check sender
|
||||||
if mode == "text" or mode == "slow":
|
if mode == "text" or mode == "slow-text":
|
||||||
expected = ("Sending text message ({bytes:d} Bytes){NL}"
|
expected = ("Sending text message ({bytes:d} Bytes){NL}"
|
||||||
"On the other computer, please run: "
|
"On the other computer, please run: "
|
||||||
"wormhole receive{NL}"
|
"wormhole receive{NL}"
|
||||||
|
@ -415,7 +415,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
.format(NL=NL), send_stdout)
|
.format(NL=NL), send_stdout)
|
||||||
|
|
||||||
# check receiver
|
# check receiver
|
||||||
if mode == "text" or mode == "slow":
|
if mode == "text" or mode == "slow-text":
|
||||||
self.failUnlessEqual(receive_stdout, message+NL)
|
self.failUnlessEqual(receive_stdout, message+NL)
|
||||||
elif mode == "file":
|
elif mode == "file":
|
||||||
self.failUnlessIn("Receiving file ({size:s}) into: {name}"
|
self.failUnlessIn("Receiving file ({size:s}) into: {name}"
|
||||||
|
@ -462,8 +462,8 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase):
|
||||||
def test_directory_override(self):
|
def test_directory_override(self):
|
||||||
return self._do_test(mode="directory", override_filename=True)
|
return self._do_test(mode="directory", override_filename=True)
|
||||||
|
|
||||||
def test_slow(self):
|
def test_slow_text(self):
|
||||||
return self._do_test(mode="slow")
|
return self._do_test(mode="slow-text")
|
||||||
|
|
||||||
@inlineCallbacks
|
@inlineCallbacks
|
||||||
def _do_test_fail(self, mode, failmode):
|
def _do_test_fail(self, mode, failmode):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user