From c576ff692a6e830529f515f84bff007db6328f5d Mon Sep 17 00:00:00 2001 From: iadrich <56698+iadrich@users.noreply.github.com> Date: Fri, 2 Feb 2024 10:28:02 +0000 Subject: [PATCH] Fix issue where tests are executed even when the task has failed (#265) --- sayn/tasks/sql.py | 1 + sayn/tasks/task_wrapper.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sayn/tasks/sql.py b/sayn/tasks/sql.py index c836af8..7ff3938 100644 --- a/sayn/tasks/sql.py +++ b/sayn/tasks/sql.py @@ -432,6 +432,7 @@ def execute(self, execute, debug): with self.step(step): if debug and query: self.write_compilation_output(query, step.replace(" ", "_").lower()) + if execute and query: try: self.target_db.execute(query) diff --git a/sayn/tasks/task_wrapper.py b/sayn/tasks/task_wrapper.py index 1a22b58..71c5a16 100644 --- a/sayn/tasks/task_wrapper.py +++ b/sayn/tasks/task_wrapper.py @@ -382,8 +382,12 @@ def execute_task(self, command): try: if command == "run": result = self.runner.run() - if self.run_arguments["with_tests"] and self.has_tests(): + + if not (isinstance(result, Result) and result.is_err) and ( + self.run_arguments["with_tests"] and self.has_tests() + ): result = self.runner.test() + elif command == "compile": result = self.runner.compile() else: