Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
goFrendiAsgard committed Nov 28, 2023
1 parent fd74d72 commit dc7e11a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/zrb/task/cmd_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,14 @@ def _on_kill(self, signum: Any, frame: Any):
self.print_out_dark(f'Getting signal {signum}')
for pid in self._pids:
self._kill_by_pid(pid)
self.print_out_dark(f'Exiting with signal {signum}')
tasks = asyncio.all_tasks()
for task in tasks:
try:
task.cancel()
except Exception as e:
self.print_err(e)
time.sleep(0.3)
self.print_out_dark(f'Exiting with signal {signum}')
sys.exit(signum)

def _on_exit(self):
Expand Down
2 changes: 1 addition & 1 deletion test/task/test_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def _run(*args, **kwargs) -> str:
del os.environ['COLOR']


def test_task_redeclared_env():
def test_task_duplicate_env():
'''
When env exist, it should override env_file,
If two env has the same name, the later should override the first one
Expand Down

0 comments on commit dc7e11a

Please sign in to comment.