Skip to content

Commit fd04243

Browse files
committed
PR Feedback 1
1 parent a54f9fe commit fd04243

3 files changed

Lines changed: 12 additions & 19 deletions

File tree

sqlmesh/core/console.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,12 @@ def log_destructive_change(
322322
class UnitTestConsole(abc.ABC):
323323
@abc.abstractmethod
324324
def log_test_results(self, result: ModelTextTestResult, target_dialect: str) -> None:
325-
"""Display the test result and output."""
325+
"""Display the test result and output.
326+
327+
Args:
328+
result: The unittest test result that contains metrics like num success, fails, ect.
329+
target_dialect: The dialect that tests were run against. Assumes all tests run against the same dialect.
330+
"""
326331

327332

328333
class Console(
@@ -470,16 +475,6 @@ def plan(
470475
fail. Default: False
471476
"""
472477

473-
@abc.abstractmethod
474-
def log_test_results(self, result: ModelTextTestResult, target_dialect: str) -> None:
475-
"""Display the test result and output.
476-
477-
Args:
478-
result: The unittest test result that contains metrics like num success, fails, ect.
479-
output: The generated output from the unittest.
480-
target_dialect: The dialect that tests were run against. Assumes all tests run against the same dialect.
481-
"""
482-
483478
@abc.abstractmethod
484479
def show_sql(self, sql: str) -> None:
485480
"""Display to the user SQL."""

sqlmesh/core/context.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2043,7 +2043,6 @@ def test(
20432043
verbosity: Verbosity = Verbosity.DEFAULT,
20442044
preserve_fixtures: bool = False,
20452045
stream: t.Optional[t.TextIO] = None,
2046-
log_results: bool = True,
20472046
) -> ModelTextTestResult:
20482047
"""Discover and run model tests"""
20492048
if verbosity >= Verbosity.VERBOSE:
@@ -2066,11 +2065,10 @@ def test(
20662065
default_catalog_dialect=self.config.dialect or "",
20672066
)
20682067

2069-
if log_results:
2070-
self.console.log_test_results(
2071-
result,
2072-
self.test_connection_config._engine_adapter.DIALECT,
2073-
)
2068+
self.console.log_test_results(
2069+
result,
2070+
self.test_connection_config._engine_adapter.DIALECT,
2071+
)
20742072

20752073
return result
20762074

@@ -2498,7 +2496,7 @@ def _run_tests(
24982496
self, verbosity: Verbosity = Verbosity.DEFAULT
24992497
) -> t.Tuple[ModelTextTestResult, str]:
25002498
test_output_io = StringIO()
2501-
result = self.test(stream=test_output_io, verbosity=verbosity, log_results=False)
2499+
result = self.test(stream=test_output_io, verbosity=verbosity)
25022500
return result, test_output_io.getvalue()
25032501

25042502
def _run_plan_tests(self, skip_tests: bool = False) -> t.Optional[ModelTextTestResult]:

sqlmesh/core/test/result.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def addSubTest(
4747
def _print_char(self, char: str) -> None:
4848
from sqlmesh.core.console import TerminalConsole
4949

50-
if self.console and isinstance(self.console, TerminalConsole):
50+
if isinstance(self.console, TerminalConsole):
5151
self.console._print(char, end="")
5252

5353
def addFailure(self, test: unittest.TestCase, err: ErrorType) -> None:

0 commit comments

Comments
 (0)