Logs with special case handling:
02025-07-17T15:07:39.774663Z TestFramework (ERROR): Called Process failed with 'None'
12025-07-17T15:18:22.039274Z TestFramework (WARNING): Exiting after keyboard interrupt
Logs without special case handling:
02025-07-17T15:19:09.169925Z TestFramework (ERROR): CalledProcessError(1, ['ls', '--invalid-flag'])
12025-07-17T15:19:26.639162Z TestFramework (ERROR): KeyboardInterrupt()
Imo, they’re equally informative for KeyboardInterrupt, and more informative without special case handling for CalledProcessError
, with less code.
0diff --git a/test/functional/feature_abortnode.py b/test/functional/feature_abortnode.py
1index a5c8aa163a..748875b25d 100755
2--- a/test/functional/feature_abortnode.py
3+++ b/test/functional/feature_abortnode.py
4@@ -22,6 +22,8 @@ class AbortNodeTest(BitcoinTestFramework):
5 # We'll connect the nodes later
6
7 def run_test(self):
8+ import subprocess
9+ subprocess.run(["ls", "--invalid-flag"], check=True)
10 self.generate(self.nodes[0], 3, sync_fun=self.no_op)
11
12 # Deleting the undo file will result in reorg failure
13diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py
14index 823d946cfe..17e5a6b397 100755
15--- a/test/functional/test_framework/test_framework.py
16+++ b/test/functional/test_framework/test_framework.py
17@@ -197,14 +197,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass):
18 except SkipTest as e:
19 self.log.warning("Test Skipped: %s" % e.message)
20 self.success = TestStatus.SKIPPED
21- except subprocess.CalledProcessError as e:
22- self.log.exception("Called Process failed with '{}'".format(e.output))
23- self.success = TestStatus.FAILED
24- except KeyboardInterrupt:
25- self.log.warning("Exiting after keyboard interrupt")
26- self.success = TestStatus.FAILED
27 except BaseException as e:
28- self.log.exception(f"Unexpected exception")
29+ self.log.exception(repr(e))
30 self.success = TestStatus.FAILED
31 finally:
32 exit_code = self.shutdown()