From 1bb4e9278a5ab11436fb3849ae8942cd891df90c Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Sun, 16 Apr 2017 16:33:50 -0400 Subject: [PATCH] CLI: remove log.err(), remove flushLoggedErrors from tests I think we're better off without this: the CLI commands propagate the Failure up to their callers (rather than eating it silently), the callers are using task.react (which reacts to Failures by exiting with rc!=0), so nothing should get lost. And doing an extra log.err() just creates more cleanup work for test cases to flush, and makes the CLI commands double-print the any errors (maybe task.react also points logging at stderr?). --- src/wormhole/cli/cmd_receive.py | 1 - src/wormhole/cli/cmd_send.py | 1 - src/wormhole/test/test_cli.py | 6 ------ 3 files changed, 8 deletions(-) diff --git a/src/wormhole/cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py index 96f31de..3407d49 100644 --- a/src/wormhole/cli/cmd_receive.py +++ b/src/wormhole/cli/cmd_receive.py @@ -95,7 +95,6 @@ class Receiver: # as the original one) @inlineCallbacks def _bad(f): - log.err(f) try: yield w.close() # might be an error too except: diff --git a/src/wormhole/cli/cmd_send.py b/src/wormhole/cli/cmd_send.py index c51a115..a923bd5 100644 --- a/src/wormhole/cli/cmd_send.py +++ b/src/wormhole/cli/cmd_send.py @@ -74,7 +74,6 @@ class Sender: # as the original one) @inlineCallbacks def _bad(f): - log.err(f) try: yield w.close() # might be an error too except: diff --git a/src/wormhole/test/test_cli.py b/src/wormhole/test/test_cli.py index 80e4088..852bc54 100644 --- a/src/wormhole/test/test_cli.py +++ b/src/wormhole/test/test_cli.py @@ -736,7 +736,6 @@ class PregeneratedCode(ServerBase, ScriptsBase, unittest.TestCase): # check server stats self._rendezvous.get_stats() - self.flushLoggedErrors(TransferError) def test_fail_file_noclobber(self): return self._do_test_fail("file", "noclobber") @@ -766,9 +765,6 @@ class NotWelcome(ServerBase, unittest.TestCase): send_d = cmd_send.send(self.cfg) f = yield self.assertFailure(send_d, WelcomeError) self.assertEqual(str(f), "please upgrade XYZ") - # TODO: this comes from log.err() in cmd_send.Sender.go._bad, and I'm - # undecided about whether that ought to be doing log.err or not - self.flushLoggedErrors(WelcomeError) @inlineCallbacks def test_receiver(self): @@ -777,7 +773,6 @@ class NotWelcome(ServerBase, unittest.TestCase): receive_d = cmd_receive.receive(self.cfg) f = yield self.assertFailure(receive_d, WelcomeError) self.assertEqual(str(f), "please upgrade XYZ") - self.flushLoggedErrors(WelcomeError) class Cleanup(ServerBase, unittest.TestCase): @@ -825,7 +820,6 @@ class Cleanup(ServerBase, unittest.TestCase): cids = self._rendezvous.get_app(cmd_send.APPID).get_nameplate_ids() self.assertEqual(len(cids), 0) - self.flushLoggedErrors(WrongPasswordError) class ExtractFile(unittest.TestCase): def test_filenames(self):