mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-27 14:01:12 +02:00
test: Do not pass tests on unhandled exceptions
This adds a missing catch for BaseException (e.g. SystemExit), which
would otherwise be silently ignored.
Also, remove the redundant other catches, which are just calling
log.exception with a redundant log message.
Github-Pull: #33001
Rebased-From: fa30b34026
This commit is contained in:
@@ -134,27 +134,18 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
|
|||||||
else:
|
else:
|
||||||
self.run_test()
|
self.run_test()
|
||||||
|
|
||||||
except JSONRPCException:
|
|
||||||
self.log.exception("JSONRPC error")
|
|
||||||
self.success = TestStatus.FAILED
|
|
||||||
except SkipTest as e:
|
except SkipTest as e:
|
||||||
self.log.warning("Test Skipped: %s" % e.message)
|
self.log.warning("Test Skipped: %s" % e.message)
|
||||||
self.success = TestStatus.SKIPPED
|
self.success = TestStatus.SKIPPED
|
||||||
except AssertionError:
|
|
||||||
self.log.exception("Assertion failed")
|
|
||||||
self.success = TestStatus.FAILED
|
|
||||||
except KeyError:
|
|
||||||
self.log.exception("Key error")
|
|
||||||
self.success = TestStatus.FAILED
|
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
self.log.exception("Called Process failed with '{}'".format(e.output))
|
self.log.exception("Called Process failed with '{}'".format(e.output))
|
||||||
self.success = TestStatus.FAILED
|
self.success = TestStatus.FAILED
|
||||||
except Exception:
|
|
||||||
self.log.exception("Unexpected exception caught during testing")
|
|
||||||
self.success = TestStatus.FAILED
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.log.warning("Exiting after keyboard interrupt")
|
self.log.warning("Exiting after keyboard interrupt")
|
||||||
self.success = TestStatus.FAILED
|
self.success = TestStatus.FAILED
|
||||||
|
except BaseException:
|
||||||
|
self.log.exception("Unexpected exception")
|
||||||
|
self.success = TestStatus.FAILED
|
||||||
finally:
|
finally:
|
||||||
exit_code = self.shutdown()
|
exit_code = self.shutdown()
|
||||||
sys.exit(exit_code)
|
sys.exit(exit_code)
|
||||||
|
Reference in New Issue
Block a user