Skip to content

Commit

Permalink
add test for child errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Hi-king committed Dec 20, 2024
1 parent 3a82af9 commit 029596b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion test/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,20 @@ def test_load_requires(self):
text = 'test'
output = gokart.build(_LoadRequires(task=_DummyTask(param=text)), reset_register=False)
self.assertEqual(output, text)


def test_build_with_child_task_error(self):
class CheckException(Exception):
pass
class FailTask(gokart.TaskOnKart):
def run(self):
raise CheckException()

try:
t = FailTask()
gokart.build(t, reset_register=False, log_level=logging.CRITICAL)
except GokartBuildError as e:
self.assertEqual(len(e.raised_exceptions), 1)
self.assertIsInstance(e.raised_exceptions[t.make_unique_id()][0], CheckException)

class LoggerConfigTest(unittest.TestCase):
def test_logger_config(self):
Expand Down

0 comments on commit 029596b

Please sign in to comment.