From c752f012f7c22398b6e4eefce687950eeac066df Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Sat, 11 Oct 2014 22:22:10 -0400 Subject: [PATCH] Start converting asserts to self.assert*() so we get better error messages --- test/v2/errors/test_errors.py | 4 ++-- test/v2/playbook/test_task.py | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/v2/errors/test_errors.py b/test/v2/errors/test_errors.py index 762aaceb6d..ca5ecc1493 100644 --- a/test/v2/errors/test_errors.py +++ b/test/v2/errors/test_errors.py @@ -32,7 +32,7 @@ class TestErrors(unittest.TestCase): def test_basic_error(self): e = AnsibleError(self.message) - assert e.message == self.message + self.assertEqual(e.message, self.message) def test_error_with_object(self): obj = AnsibleBaseYAMLObject() @@ -45,4 +45,4 @@ class TestErrors(unittest.TestCase): with patch('__builtin__.open', m): e = AnsibleError(self.message, obj) - assert e.message == 'this is the error message\nThe error occurred on line 1 of the file foo.yml:\nthis is line 1\n^' + self.assertEqual(e.message, 'this is the error message\nThe error occurred on line 1 of the file foo.yml:\nthis is line 1\n^') diff --git a/test/v2/playbook/test_task.py b/test/v2/playbook/test_task.py index 76ad0e2447..b6f869cd21 100644 --- a/test/v2/playbook/test_task.py +++ b/test/v2/playbook/test_task.py @@ -50,20 +50,20 @@ class TestTask(unittest.TestCase): def test_load_task_simple(self): t = Task.load(basic_shell_task) assert t is not None - assert t.name == basic_shell_task['name'] - assert t.action == 'command' - assert t.args == dict(_raw_params='echo hi', _uses_shell=True) + self.assertEqual(t.name, basic_shell_task['name']) + self.assertEqual(t.action, 'command') + self.assertEqual(t.args, dict(_raw_params='echo hi', _uses_shell=True)) def test_load_task_kv_form(self): t = Task.load(kv_shell_task) - print "task action is %s" % t.action - assert t.action == 'command' - assert t.args == dict(_raw_params='echo hi', _uses_shell=True) + print("task action is %s" % t.action) + self.assertEqual(t.action, 'command') + self.assertEqual(t.args, dict(_raw_params='echo hi', _uses_shell=True)) def test_task_auto_name(self): assert 'name' not in kv_shell_task t = Task.load(kv_shell_task) - #assert t.name == 'shell echo hi' + #self.assertEqual(t.name, 'shell echo hi') def test_task_auto_name_with_role(self): pass