diff --git a/src/wormhole/scripts/cli_args.py b/src/wormhole/scripts/cli_args.py index 90169d4..c650768 100644 --- a/src/wormhole/scripts/cli_args.py +++ b/src/wormhole/scripts/cli_args.py @@ -27,8 +27,6 @@ g.add_argument("--hide-progress", action="store_true", help="supress progress-bar display") g.add_argument("--dump-timing", type=type(u""), # TODO: hide from --help output metavar="FILE", help="(debug) write timing data to file") -g.add_argument("--twisted", action="store_true", - help="use Twisted-based implementations, for testing") g.add_argument("--no-listen", action="store_true", help="(debug) don't open a listening socket for Transit") g.add_argument("--tor", action="store_true", diff --git a/src/wormhole/scripts/runner.py b/src/wormhole/scripts/runner.py index 32e9c88..bb71b8c 100644 --- a/src/wormhole/scripts/runner.py +++ b/src/wormhole/scripts/runner.py @@ -21,22 +21,14 @@ def dispatch(args): from ..servers import cmd_usage return cmd_usage.tail_usage(args) - if args.tor: - args.twisted = True if args.func == "send/send": - if args.twisted: - from . import cmd_send_twisted - return cmd_send_twisted.send_twisted_sync(args) - from . import cmd_send_blocking - return cmd_send_blocking.send_blocking(args) + from . import cmd_send_twisted + return cmd_send_twisted.send_twisted_sync(args) if args.func == "receive/receive": - if args.twisted: - _start = args.timing.add_event("import c_r_t") - from . import cmd_receive_twisted - args.timing.finish_event(_start) - return cmd_receive_twisted.receive_twisted_sync(args) - from . import cmd_receive_blocking - return cmd_receive_blocking.receive_blocking(args) + _start = args.timing.add_event("import c_r_t") + from . import cmd_receive_twisted + args.timing.finish_event(_start) + return cmd_receive_twisted.receive_twisted_sync(args) raise ValueError("unknown args.func %s" % args.func) diff --git a/src/wormhole/test/test_scripts.py b/src/wormhole/test/test_scripts.py index 2939f67..8ffea2d 100644 --- a/src/wormhole/test/test_scripts.py +++ b/src/wormhole/test/test_scripts.py @@ -4,11 +4,9 @@ from twisted.trial import unittest from twisted.python import procutils, log from twisted.internet.utils import getProcessOutputAndValue from twisted.internet.defer import inlineCallbacks -from twisted.internet.threads import deferToThread from .. import __version__ from .common import ServerBase -from ..scripts import (runner, cmd_send_blocking, cmd_send_twisted, - cmd_receive_blocking, cmd_receive_twisted) +from ..scripts import runner, cmd_send_twisted, cmd_receive_twisted from ..scripts.send_common import build_phase1_data from ..errors import TransferError from ..timing import DebugTiming @@ -219,8 +217,7 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): @inlineCallbacks def _do_test(self, as_subprocess=False, - mode="text", addslash=False, override_filename=False, - sender_twisted=False, receiver_twisted=False): + mode="text", addslash=False, override_filename=False): assert mode in ("text", "file", "directory") common_args = ["--hide-progress", "--relay-url", self.relayurl, @@ -314,14 +311,8 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): rargs.stdout = io.StringIO() rargs.stderr = io.StringIO() rargs.timing = DebugTiming() - if sender_twisted: - send_d = cmd_send_twisted.send_twisted(sargs) - else: - send_d = deferToThread(cmd_send_blocking.send_blocking, sargs) - if receiver_twisted: - receive_d = cmd_receive_twisted.receive_twisted(rargs) - else: - receive_d = deferToThread(cmd_receive_blocking.receive_blocking, rargs) + send_d = cmd_send_twisted.send_twisted(sargs) + receive_d = cmd_receive_twisted.receive_twisted(rargs) # The sender might fail, leaving the receiver hanging, or vice # versa. If either side fails, cancel the other, so it won't @@ -418,24 +409,11 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): return self._do_test() def test_text_subprocess(self): return self._do_test(as_subprocess=True) - def test_text_twisted_to_blocking(self): - return self._do_test(sender_twisted=True) - def test_text_blocking_to_twisted(self): - return self._do_test(receiver_twisted=True) - def test_text_twisted_to_twisted(self): - return self._do_test(sender_twisted=True, receiver_twisted=True) def test_file(self): return self._do_test(mode="file") def test_file_override(self): return self._do_test(mode="file", override_filename=True) - def test_file_twisted_to_blocking(self): - return self._do_test(mode="file", sender_twisted=True) - def test_file_blocking_to_twisted(self): - return self._do_test(mode="file", receiver_twisted=True) - def test_file_twisted_to_twisted(self): - return self._do_test(mode="file", - sender_twisted=True, receiver_twisted=True) def test_directory(self): return self._do_test(mode="directory") @@ -443,16 +421,3 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): return self._do_test(mode="directory", addslash=True) def test_directory_override(self): return self._do_test(mode="directory", override_filename=True) - def test_directory_twisted_to_blocking(self): - return self._do_test(mode="directory", sender_twisted=True) - def test_directory_twisted_to_blocking_addslash(self): - return self._do_test(mode="directory", addslash=True, - sender_twisted=True) - def test_directory_blocking_to_twisted(self): - return self._do_test(mode="directory", receiver_twisted=True) - def test_directory_twisted_to_twisted(self): - return self._do_test(mode="directory", - sender_twisted=True, receiver_twisted=True) - def test_directory_twisted_to_twisted_addslash(self): - return self._do_test(mode="directory", addslash=True, - sender_twisted=True, receiver_twisted=True)