aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_taskipy.py
diff options
context:
space:
mode:
authorTsunenobu Kai <kai2nenobu@gmail.com>2020-12-26 00:51:33 +0900
committerGitHub <noreply@github.com>2020-12-25 17:51:33 +0200
commit5aaeb1298987265e312cd4318bea82cade39f085 (patch)
treefdf7e85d329a5321e071067bd76a767bf2f93f5a /tests/test_taskipy.py
parentRelease version 1.5.1 (diff)
downloadtaskipy2-5aaeb1298987265e312cd4318bea82cade39f085.zip
Find a parent pyproject.toml from a child directory (#28)
Enable running tasks defined in parent pyproject.toml from a child directory.
Diffstat (limited to 'tests/test_taskipy.py')
-rw-r--r--tests/test_taskipy.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/test_taskipy.py b/tests/test_taskipy.py
index bc227d4..d70b88d 100644
--- a/tests/test_taskipy.py
+++ b/tests/test_taskipy.py
@@ -94,7 +94,6 @@ class RunTaskTestCase(TaskipyTestCase):
self.assertSubstr('hello stderr', stderr)
-
class TaskPrePostHooksTestCase(TaskipyTestCase):
def test_running_pre_task_hook(self):
cwd = self.create_test_dir_from_fixture('project_with_pre_post_task_hooks')
@@ -234,7 +233,7 @@ class TaskRunFailTestCase(TaskipyTestCase):
cwd = self.create_test_dir_from_fixture('project_without_pyproject')
exit_code, stdout, _ = self.run_task('some_task', cwd=cwd)
- self.assertSubstr('no pyproject.toml file found in this directory', stdout)
+ self.assertSubstr('no pyproject.toml file found in this directory or parent directories', stdout)
self.assertEqual(exit_code, 1)
def test_exiting_with_code_1_and_printing_if_pyproject_toml_file_is_malformed(self):
@@ -340,3 +339,17 @@ class CustomRunnerTestCase(TaskipyTestCase):
self.assertSubstr('invalid value: runner is not a string. please check [tool.taskipy.settings.runner]', stdout)
self.assertEqual(exit_code, 1)
+
+
+class TaskFromChildTestCase(TaskipyTestCase):
+ def test_running_parent_pyproject_task_from_child_directory(self):
+ cwd = self.create_test_dir_from_fixture('project_with_tasks_from_child')
+ _, stdout, _ = self.run_task('print_current_dir_name', cwd=path.join(cwd, 'child_without_pyproject'))
+
+ self.assertSubstr('child_without_pyproject', stdout)
+
+ def test_find_nearest_pyproject_from_child_directory(self):
+ cwd = self.create_test_dir_from_fixture('project_with_tasks_from_child')
+ _, stdout, _ = self.run_task('hello', cwd=path.join(cwd, 'child_with_pyproject'))
+
+ self.assertSubstr('hello from child', stdout)