From 51fe6c6849da2afdce13881a657d49cf7da80e69 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sun, 30 Jul 2023 06:44:57 -0400 Subject: GH-63: Fix use_vars task override with project setting (#64) * from now on, the use_vars task-level setting takes priority if it is ever explicitly set. Otherwise, the project-level setting is used * closes #63 --- tests/test_taskipy.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests') diff --git a/tests/test_taskipy.py b/tests/test_taskipy.py index 9cf680a..a9d0b2c 100644 --- a/tests/test_taskipy.py +++ b/tests/test_taskipy.py @@ -554,6 +554,38 @@ class UseVarsTestCase(TaskipyTestCase): self.assertSubstr('hello John Doe :', stdout) self.assertEqual(exit_code, 0) + def test_use_vars_setting_override_to_false(self): + py_project_toml = ''' + [tool.taskipy.settings] + use_vars = true + + [tool.taskipy.variables] + name = "John Doe" + + [tool.taskipy.tasks] + echo = { cmd = "echo hello {name}:", use_vars = false } + ''' + cwd = self.create_test_dir_with_py_project_toml(py_project_toml) + exit_code, stdout, _ = self.run_task('echo', cwd=cwd) + self.assertSubstr('hello {name}:', stdout) + self.assertEqual(exit_code, 0) + + def test_use_vars_setting_override_to_true(self): + py_project_toml = ''' + [tool.taskipy.settings] + use_vars = false + + [tool.taskipy.variables] + name = "John Doe" + + [tool.taskipy.tasks] + echo = { cmd = "echo hello {name}:", use_vars = true } + ''' + cwd = self.create_test_dir_with_py_project_toml(py_project_toml) + exit_code, stdout, _ = self.run_task('echo', cwd=cwd) + self.assertSubstr('hello John Doe:', stdout) + self.assertEqual(exit_code, 0) + class RecursiveVariablesTestCase(TaskipyTestCase): def test_recursive_variables_can_use_other_variables(self): -- cgit v1.2.3