mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-13 03:44:02 -07:00
Add better error when k=v syntax is used with YAML in tasks (#41754)
* Add error message for k=v and YAML in a single task Find the correct line, column, and position for k=v errors since they are different than the position reported initially. Document bug in quoting syntax check. * Change tense or error message Since the error still exists, switch to present tense rather than past tense. * Remove double spaces after periods in error messages. http://www.slate.com/articles/technology/technology/2011/01/space_invaders.html * Add changelog fragment * Add tests for new error message * Fix tests * Add clarifying comments to unit test
This commit is contained in:
parent
2f8d235ce5
commit
40a5f7bfdf
5 changed files with 67 additions and 21 deletions
|
@ -84,11 +84,11 @@ class TestTask(unittest.TestCase):
|
|||
self.assertIsInstance(cm.exception, errors.AnsibleParserError)
|
||||
self.assertEqual(cm.exception._obj, ds)
|
||||
self.assertEqual(cm.exception._obj, kv_bad_args_ds)
|
||||
self.assertIn("The error appears to have been in 'test_task_faux_playbook.yml", cm.exception.message)
|
||||
self.assertIn("The error appears to be in 'test_task_faux_playbook.yml", cm.exception.message)
|
||||
self.assertIn(kv_bad_args_str, cm.exception.message)
|
||||
self.assertIn('apk', cm.exception.message)
|
||||
self.assertEquals(cm.exception.message.count('The offending line'), 1)
|
||||
self.assertEquals(cm.exception.message.count('The error appears to have been in'), 1)
|
||||
self.assertEquals(cm.exception.message.count('The error appears to be in'), 1)
|
||||
|
||||
def test_task_auto_name(self):
|
||||
assert 'name' not in kv_command_task
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue