aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2023-07-30 06:44:57 -0400
committerGitHub <noreply@github.com>2023-07-30 13:44:57 +0300
commit51fe6c6849da2afdce13881a657d49cf7da80e69 (patch)
tree116464b0901f357eddfc0311004db88f4a6eb9e9 /tests
parentRelease version 1.11.0 (diff)
downloadtaskipy2-51fe6c6849da2afdce13881a657d49cf7da80e69.zip
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
Diffstat (limited to 'tests')
-rw-r--r--tests/test_taskipy.py32
1 files changed, 32 insertions, 0 deletions
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):