From 3198c7fa6016752b29ff36e3e221c1238d8cbd6b Mon Sep 17 00:00:00 2001 From: dandaedre Date: Tue, 21 Sep 2021 10:28:58 +0200 Subject: [PATCH] Added a verbose-ish mode --- minitest.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/minitest.py b/minitest.py index 7042f09..329c702 100755 --- a/minitest.py +++ b/minitest.py @@ -82,7 +82,11 @@ class testGroup(object): for test in self._tests: try: list_status,total,log_results=self.print_result(test.test()) - except: + except Exception as e: + print(self.t.bright_red("[ERROR] An unhandled error occured during the execution of the tests")) + raise(e) + # for l in e: + # print(l) list_status,total,log_results=self.print_result([]) print(self.pretty_subtests(test.name,list_status,total)) @@ -220,6 +224,7 @@ class testUnit(object): self._tests=[] self.name=name self.results=[] + self.verbose=False def __str__(self): return self.name @@ -306,10 +311,14 @@ class simpleTestUnit(testUnit): self.criticalTraceback() except Exception as e: if len(self.list_ongoing_tests)>0: - self.addFailure(e) + if self.verbose==False: + self.addFailure(e) + else: + raise e else: #self.criticalTraceback() #This is an arguable choice self.addResult("minitest.py:error",CRITICAL_STATUS,e) + return self.results def criticalTraceback(self):