aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2021-03-28 15:32:26 -0500
committerGitHub <noreply@github.com>2021-03-28 23:32:26 +0300
commit40cf72c806f9e05f2a1926848becdaed011b3838 (patch)
tree18f3d897fae8cf0753317d0e7dfb2a82d583e9de /tests
parentUpdate README.md (diff)
downloadtaskipy2-40cf72c806f9e05f2a1926848becdaed011b3838.zip
Add usage printout when no task is given (#31)
* Add usage printout when no task is given This addresses issue #30 where 'could not find task "None"' would be outputted when simply `task` is ran without an task name. * Simplify InvalidUsageError's __str__ method * Ignore pyenv's local python version file * Update dependencies in lockfile a.k.a. ran `poetry update` * Disable W0707 in pylint
Diffstat (limited to 'tests')
-rw-r--r--tests/test_taskipy.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_taskipy.py b/tests/test_taskipy.py
index d70b88d..cac0809 100644
--- a/tests/test_taskipy.py
+++ b/tests/test_taskipy.py
@@ -222,6 +222,21 @@ class TaskRunFailTestCase(TaskipyTestCase):
self.assertSubstr('could not find task "task_that_does_not_exist"', stdout)
self.assertEqual(exit_code, 127)
+ def test_exiting_with_code_127_and_printing_if_no_arg_is_passed(self):
+ cwd = self.create_test_dir_from_fixture('project_with_pyproject_and_tasks')
+ executable_path = path.abspath('task')
+ proc = subprocess.Popen(
+ executable_path,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ cwd=cwd
+ )
+ stdout, _ = proc.communicate()
+
+ self.assertSubstr('usage: task', stdout.decode())
+ self.assertEqual(proc.returncode, 127)
+
def test_exiting_with_code_127_and_printing_if_no_tasks_section(self):
cwd = self.create_test_dir_from_fixture('project_with_pyproject_without_tasks_section')
exit_code, stdout, _ = self.run_task('task_that_does_not_exist', cwd=cwd)