Skip to content

Commit

Permalink
refactor: moved tasks message into subsection
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalinDe committed Sep 6, 2023
1 parent f2a4744 commit fb04ace
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pusteblume/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@


MESSAGES = {
"no_running_task": "no running task",
"tasks": {
"no_running_task": "no running task",
},
"config": {
"default": "generated default configuration file {config_file}",
},
Expand Down
4 changes: 2 additions & 2 deletions pusteblume/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def stop(config):
"""
rows = _query_currently_running_task(config)
if not rows:
return pusteblume.messages.MESSAGES["no_running_task"]
return pusteblume.messages.MESSAGES["tasks"]["no_running_task"]
end_time = datetime.datetime.now()
_execute(config, "UPDATE task SET end_time = ? WHERE end_time IS NULL", (end_time,))
return os.linesep.join(
Expand All @@ -350,7 +350,7 @@ def status(config):
"""
rows = _query_currently_running_task(config)
if not rows:
return pusteblume.messages.MESSAGES["no_running_task"]
return pusteblume.messages.MESSAGES["tasks"]["no_running_task"]
(task_id, name, start_time) = rows[0]
return Task(
name,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_status_no_running_task(self):
"""
self.assertEqual(
pusteblume.tasks.status(self.config),
pusteblume.messages.MESSAGES["no_running_task"],
pusteblume.messages.MESSAGES["tasks"]["no_running_task"],
)

def test_status_running_task(self):
Expand Down

0 comments on commit fb04ace

Please sign in to comment.