aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRoy Sommer <illBeRoy@users.noreply.github.com>2022-08-31 22:22:08 +0300
committerGitHub <noreply@github.com>2022-08-31 22:22:08 +0300
commit62b47b6f081f8b22479dca79c29409cb45319e25 (patch)
tree3e1ac9e80985d7df1f66963f57b44f93bb0caffb /tests
parentRelease version 1.10.2 (diff)
downloadtaskipy2-62b47b6f081f8b22479dca79c29409cb45319e25.zip
handle listing tasks when there are no tasks (#52)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_taskipy.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_taskipy.py b/tests/test_taskipy.py
index 7b67fd3..4b9b347 100644
--- a/tests/test_taskipy.py
+++ b/tests/test_taskipy.py
@@ -221,6 +221,24 @@ class ListTasksTestCase(TaskipyTestCase):
self.assertTerminalTextEqual(expected, stdout.strip())
self.assertEqual(exit_code, 0)
+ def test_running_task_list_no_tasks(self):
+ py_project_toml = '''
+ [tool.taskipy.tasks]
+ '''
+ cwd = self.create_test_dir_with_py_project_toml(py_project_toml)
+ exit_code, stdout, _ = self.run_task('--list', cwd=cwd)
+
+ self.assertTerminalTextEqual('no tasks found. create your first task by adding it to your pyproject.toml file under [tool.taskipy.tasks]', stdout.strip())
+ self.assertEqual(exit_code, 127)
+
+ def test_running_task_list_no_tasks_section(self):
+ py_project_toml = ''
+ cwd = self.create_test_dir_with_py_project_toml(py_project_toml)
+ exit_code, stdout, _ = self.run_task('--list', cwd=cwd)
+
+ self.assertTerminalTextEqual('no tasks found. add a [tool.taskipy.tasks] section to your pyproject.toml', stdout.strip())
+ self.assertEqual(exit_code, 127)
+
class TaskDescriptionTestCase(TaskipyTestCase):
def test_running_task_with_description(self):