Skip to content

Commit

Permalink
Remove unnecessary method based on @edgga's comment on d70e6d7 and PR #…
Browse files Browse the repository at this point in the history
  • Loading branch information
tatiana committed Sep 27, 2023
1 parent d8f1a1c commit 0566be5
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions cosmos/operators/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,19 +460,6 @@ def __init__(
self.base_cmd = ["test"]
self.on_warning_callback = on_warning_callback

def _should_run_tests(
self,
result: FullOutputSubprocessResult,
no_tests_message: str = "Nothing to do",
) -> bool:
"""
Check if any tests are defined to run in the DAG. If tests are defined
and on_warning_callback is set, then function returns True.
:param result: The output from the build and run command.
"""
return self.on_warning_callback is not None and no_tests_message not in result.output

def _handle_warnings(self, result: FullOutputSubprocessResult, context: Context) -> None:
"""
Handles warnings by extracting log issues, creating additional context, and calling the
Expand All @@ -492,7 +479,7 @@ def _handle_warnings(self, result: FullOutputSubprocessResult, context: Context)

def execute(self, context: Context) -> None:
result = self.build_and_run_cmd(context=context)
if self._should_run_tests(result):
if self.on_warning_callback:
warnings = parse_output(result, "WARN")
if warnings > 0:
self._handle_warnings(result, context)
Expand Down

0 comments on commit 0566be5

Please sign in to comment.