Fix the broken fake_react by not using the argv feature

This commit is contained in:
Jean-Paul Calderone 2020-12-16 20:58:27 -05:00
parent a4b0b4a01a
commit 2746eb9ae1
2 changed files with 3 additions and 3 deletions

View File

@ -180,7 +180,7 @@ def run(argv=sys.argv, stderr=sys.stderr):
from allmydata.windows.fixups import initialize from allmydata.windows.fixups import initialize
initialize() initialize()
# doesn't return: calls sys.exit(rc) # doesn't return: calls sys.exit(rc)
task.react(_run_with_reactor, argv, stderr) task.react(lambda reactor: _run_with_reactor(reactor, argv, stderr))
def _setup_coverage(reactor, argv): def _setup_coverage(reactor, argv):

View File

@ -524,12 +524,12 @@ class CLI(CLITestMixin, unittest.TestCase):
ns.sys_exit_called = True ns.sys_exit_called = True
self.failUnlessEqual(exitcode, 1) self.failUnlessEqual(exitcode, 1)
def fake_react(f, *args): def fake_react(f):
reactor = Mock() reactor = Mock()
# normally this Deferred would be errbacked with SystemExit, but # normally this Deferred would be errbacked with SystemExit, but
# since we mocked out sys.exit, it will be fired with None. So # since we mocked out sys.exit, it will be fired with None. So
# it's safe to drop it on the floor. # it's safe to drop it on the floor.
f(reactor, *args) f(reactor)
patcher = MonkeyPatcher((runner, 'parse_or_exit_with_explanation', patcher = MonkeyPatcher((runner, 'parse_or_exit_with_explanation',
call_parse_or_exit), call_parse_or_exit),