@@ -463,7 +463,7 @@ def plan(
463463
464464 @abc .abstractmethod
465465 def log_test_results (
466- self , result : unittest . result . TestResult , output : t .Optional [str ], target_dialect : str
466+ self , result : ModelTextTestResult , output : t .Optional [str ], target_dialect : str
467467 ) -> None :
468468 """Display the test result and output.
469469
@@ -498,7 +498,9 @@ def loading_stop(self, id: uuid.UUID) -> None:
498498 """Stop loading for the given id."""
499499
500500 @abc .abstractmethod
501- def log_unit_test_results (self , result : ModelTextTestResult , test_duration : float ) -> None :
501+ def log_unit_test_results (
502+ self , result : ModelTextTestResult , test_duration : t .Optional [float ] = None
503+ ) -> None :
502504 """Print the unit test results."""
503505
504506
@@ -674,7 +676,7 @@ def plan(
674676 plan_builder .apply ()
675677
676678 def log_test_results (
677- self , result : unittest . result . TestResult , output : t .Optional [str ], target_dialect : str
679+ self , result : ModelTextTestResult , output : t .Optional [str ], target_dialect : str
678680 ) -> None :
679681 pass
680682
@@ -782,7 +784,9 @@ def start_destroy(self) -> bool:
782784 def stop_destroy (self , success : bool = True ) -> None :
783785 pass
784786
785- def log_unit_test_results (self , result : ModelTextTestResult , test_duration : float ) -> None :
787+ def log_unit_test_results (
788+ self , result : ModelTextTestResult , test_duration : t .Optional [float ] = None
789+ ) -> None :
786790 pass
787791
788792
@@ -1961,9 +1965,13 @@ def _prompt_promote(self, plan_builder: PlanBuilder) -> None:
19611965 plan_builder .apply ()
19621966
19631967 def log_test_results (
1964- self , result : unittest . result . TestResult , output : t .Optional [str ], target_dialect : str
1968+ self , result : ModelTextTestResult , output : t .Optional [str ], target_dialect : str
19651969 ) -> None :
19661970 divider_length = 70
1971+
1972+ self .log_unit_test_results (result )
1973+
1974+ self ._print ("\n " )
19671975 if result .wasSuccessful ():
19681976 self ._print ("=" * divider_length )
19691977 self ._print (
@@ -1980,7 +1988,7 @@ def log_test_results(
19801988 )
19811989 for test , _ in result .failures + result .errors :
19821990 if isinstance (test , ModelTest ):
1983- self ._print (f"Failure Test: { test .model . name } { test .test_name } " )
1991+ self ._print (f"Failure Test: { test .path } :: { test .test_name } " )
19841992 self ._print ("=" * divider_length )
19851993 self ._print (output )
19861994
@@ -2500,7 +2508,9 @@ def show_linter_violations(
25002508 else :
25012509 self .log_warning (msg )
25022510
2503- def log_unit_test_results (self , result : ModelTextTestResult , test_duration : float ) -> None :
2511+ def log_unit_test_results (
2512+ self , result : ModelTextTestResult , test_duration : t .Optional [float ] = None
2513+ ) -> None :
25042514 tests_run = result .testsRun
25052515 errors = result .errors
25062516 failures = result .original_failures
@@ -2524,22 +2534,27 @@ def log_unit_test_results(self, result: ModelTextTestResult, test_duration: floa
25242534
25252535 if test_description := test_case .shortDescription ():
25262536 self ._print (test_description )
2527- self ._print (f"{ unittest .TextTestResult .separator2 } \n " )
2537+ self ._print (f"{ unittest .TextTestResult .separator2 } " )
25282538
25292539 if exception := failure [1 ]:
2530- for arg in exception .args :
2540+ for i , arg in enumerate (exception .args ):
2541+ arg = f"Exception: { arg } " if isinstance (arg , str ) else arg
25312542 self ._print (arg )
2532- self ._print ("\n " )
2543+
2544+ if i < len (exception .args ) - 1 :
2545+ self ._print ("\n " )
25332546
25342547 for test_case , error in errors :
25352548 self ._print (unittest .TextTestResult .separator1 )
25362549 self ._print (f"ERROR: { test_case } " )
2550+ self ._print (f"{ unittest .TextTestResult .separator2 } " )
25372551 self ._print (error )
25382552
25392553 # Output final report
25402554 self ._print (unittest .TextTestResult .separator2 )
2555+ test_duration_msg = f" in { test_duration :.3f} s" if test_duration else ""
25412556 self ._print (
2542- f"Ran { tests_run } { 'tests' if tests_run > 1 else 'test' } in { test_duration :.3f } s \n "
2557+ f"\n Ran { tests_run } { 'tests' if tests_run > 1 else 'test' } { test_duration_msg } \n "
25432558 )
25442559 self ._print (
25452560 f"{ 'OK' if is_success else 'FAILED' } { ' (' + ', ' .join (infos ) + ')' if infos else '' } "
@@ -2817,7 +2832,7 @@ def radio_button_selected(change: t.Dict[str, t.Any]) -> None:
28172832 self .display (radio )
28182833
28192834 def log_test_results (
2820- self , result : unittest . result . TestResult , output : t .Optional [str ], target_dialect : str
2835+ self , result : ModelTextTestResult , output : t .Optional [str ], target_dialect : str
28212836 ) -> None :
28222837 import ipywidgets as widgets
28232838
@@ -3191,8 +3206,12 @@ def log_success(self, message: str) -> None:
31913206 self ._print (message )
31923207
31933208 def log_test_results (
3194- self , result : unittest . result . TestResult , output : t .Optional [str ], target_dialect : str
3209+ self , result : ModelTextTestResult , output : t .Optional [str ], target_dialect : str
31953210 ) -> None :
3211+ # self._print("```")
3212+ self .log_unit_test_results (result )
3213+ # self._print("```\n\n")
3214+
31963215 if result .wasSuccessful ():
31973216 self ._print (
31983217 f"**Successfully Ran `{ str (result .testsRun )} ` Tests Against `{ target_dialect } `**\n \n "
@@ -3204,6 +3223,7 @@ def log_test_results(
32043223 for test , _ in result .failures + result .errors :
32053224 if isinstance (test , ModelTest ):
32063225 self ._print (f"* Failure Test: `{ test .model .name } ` - `{ test .test_name } `\n \n " )
3226+
32073227 self ._print (f"```{ output } ```\n \n " )
32083228
32093229 def log_skipped_models (self , snapshot_names : t .Set [str ]) -> None :
@@ -3584,7 +3604,7 @@ def show_model_difference_summary(
35843604 self ._write (f" Modified: { modified } " )
35853605
35863606 def log_test_results (
3587- self , result : unittest . result . TestResult , output : t .Optional [str ], target_dialect : str
3607+ self , result : ModelTextTestResult , output : t .Optional [str ], target_dialect : str
35883608 ) -> None :
35893609 self ._write ("Test Results:" , result )
35903610
0 commit comments