diff options
author | Peter Razumovsky <prazumovsky@mirantis.com> | 2015-10-08 17:22:59 +0300 |
---|---|---|
committer | Peter Razumovsky <prazumovsky@mirantis.com> | 2015-10-09 09:23:33 +0300 |
commit | 54a1715e348720ab31b5d2e38035bf429471cdbe (patch) | |
tree | a1796cb077dd625b3554e8001c4944f3a58e0135 /heatclient/tests/unit/test_environment_format.py | |
parent | 6c86efc1a39792cb08e18ff6bd5ca3af0c1739ed (diff) | |
download | python-heatclient-54a1715e348720ab31b5d2e38035bf429471cdbe.tar.gz |
Add option for detailed template error
Add option detailed_template_error for informative
error during template and environment parsing.
yaml.SafeLoader returns error with template snippet where
error has been occurred instead of CSafeLoader. But
CSafeLoader is faster. So, if user wants to get more
informative error, use slower but more detailed SafeLoader
for yaml loading.
Change-Id: Ied0a573a00eb5f564dea0c636da1301de5de9ea7
Closes-bug: #1496361
Diffstat (limited to 'heatclient/tests/unit/test_environment_format.py')
-rw-r--r-- | heatclient/tests/unit/test_environment_format.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/heatclient/tests/unit/test_environment_format.py b/heatclient/tests/unit/test_environment_format.py index 702619d..faea505 100644 --- a/heatclient/tests/unit/test_environment_format.py +++ b/heatclient/tests/unit/test_environment_format.py @@ -13,6 +13,7 @@ from heatclient.common import environment_format import mock +import six import testscenarios import testtools import yaml @@ -78,3 +79,14 @@ class YamlParseExceptions(testtools.TestCase): self.assertRaises(ValueError, environment_format.parse, text) + + +class DetailedYAMLParseExceptions(testtools.TestCase): + + def test_parse_to_value_exception(self): + yaml = """not important +but very: + - incorrect +""" + ex = self.assertRaises(ValueError, environment_format.parse, yaml) + self.assertIn('but very:\n ^', six.text_type(ex)) |