mirror of
https://github.com/virt-manager/virt-manager.git
synced 2026-08-09 04:28:17 -05:00
pycodestyle: Do not use bare 'except:'
A bare 'except:' catches all exceptions [1], including SystemExit, KeyboardInterrupt, and GeneratorExit (which is not an error and should not normally be caught by user code). In situations where you need to catch all “normal” errors, you can catch the base class for all normal exceptions, Exception [2]. [1] https://docs.python.org/2/howto/doanddont.html#except [2] https://docs.python.org/2/library/exceptions.html#Exception
This commit is contained in:
committed by
Cole Robinson
parent
2fd6d9aa32
commit
b93cc3bbc9
@@ -422,7 +422,7 @@ class TestBaseCommand(distutils.core.Command):
|
||||
try:
|
||||
import coverage
|
||||
use_cov = True
|
||||
except:
|
||||
except ImportError:
|
||||
use_cov = False
|
||||
cov = None
|
||||
|
||||
@@ -439,10 +439,8 @@ class TestBaseCommand(distutils.core.Command):
|
||||
testsmodule.utils.REGENERATE_OUTPUT = bool(self.regenerate_output)
|
||||
|
||||
if hasattr(unittest, "installHandler"):
|
||||
try:
|
||||
unittest.installHandler()
|
||||
except:
|
||||
print("installHandler hack failed")
|
||||
# Install the control-c handler.
|
||||
unittest.installHandler()
|
||||
|
||||
tests = unittest.TestLoader().loadTestsFromNames(self._testfiles)
|
||||
if self.only:
|
||||
|
||||
Reference in New Issue
Block a user