@@ -65,7 +65,6 @@ def __init__(
6565 default_catalog : str | None = None ,
6666 concurrency : bool = False ,
6767 verbosity : Verbosity = Verbosity .DEFAULT ,
68- rich_output : bool = True ,
6968 ) -> None :
7069 """ModelTest encapsulates a unit test for a model.
7170
@@ -90,7 +89,6 @@ def __init__(
9089 self .dialect = dialect
9190 self .concurrency = concurrency
9291 self .verbosity = verbosity
93- self .rich_output = rich_output
9492
9593 self ._fixture_table_cache : t .Dict [str , exp .Table ] = {}
9694 self ._normalized_column_name_cache : t .Dict [str , str ] = {}
@@ -142,6 +140,12 @@ def __init__(
142140
143141 super ().__init__ ()
144142
143+ def defaultTestResult (self ) -> unittest .TestResult :
144+ from sqlmesh .core .test .result import ModelTextTestResult
145+ import sys
146+
147+ return ModelTextTestResult (stream = sys .stdout , descriptions = True , verbosity = self .verbosity )
148+
145149 def shortDescription (self ) -> t .Optional [str ]:
146150 return self .body .get ("description" )
147151
@@ -293,25 +297,23 @@ def _to_hashable(x: t.Any) -> t.Any:
293297 if expected .shape != actual .shape :
294298 _raise_if_unexpected_columns (expected .columns , actual .columns )
295299
296- error_msg = "Data mismatch (rows are different)"
300+ args . append ( "Data mismatch (rows are different)" )
297301
298302 missing_rows = _row_difference (expected , actual )
299303 if not missing_rows .empty :
300- error_msg += f" \n \n Missing rows: \n \n { missing_rows } "
304+ args . append ( df_to_table ( "Missing rows" , missing_rows ))
301305
302306 unexpected_rows = _row_difference (actual , expected )
307+
303308 if not unexpected_rows .empty :
304- error_msg += f" \n \n Unexpected rows: \n \n { unexpected_rows } "
309+ args . append ( df_to_table ( "Unexpected rows" , unexpected_rows ))
305310
306- args .append (error_msg )
307311 else :
308312 diff = expected .compare (actual ).rename (
309313 columns = {"self" : "Expected" , "other" : "Actual" }
310314 )
311315
312- if not self .rich_output :
313- args .append (f"Data mismatch\n \n { diff } " )
314- elif self .verbosity == Verbosity .DEFAULT :
316+ if self .verbosity == Verbosity .DEFAULT :
315317 args .append (df_to_table ("Data mismatch" , diff ))
316318 else :
317319 from pandas import MultiIndex
@@ -714,7 +716,6 @@ def __init__(
714716 default_catalog : str | None = None ,
715717 concurrency : bool = False ,
716718 verbosity : Verbosity = Verbosity .DEFAULT ,
717- rich_output : bool = True ,
718719 ) -> None :
719720 """PythonModelTest encapsulates a unit test for a Python model.
720721
@@ -742,7 +743,6 @@ def __init__(
742743 default_catalog ,
743744 concurrency ,
744745 verbosity ,
745- rich_output ,
746746 )
747747
748748 self .context = TestExecutionContext (
0 commit comments