From 2cd3a1be00e595ab2d26d196e7d18859aff6f02f Mon Sep 17 00:00:00 2001 From: Matt Martz Date: Tue, 30 Jun 2015 11:02:33 -0500 Subject: [PATCH] assertRaises should be given an exception type. Fixes 11441 --- test/units/parsing/yaml/test_loader.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/units/parsing/yaml/test_loader.py b/test/units/parsing/yaml/test_loader.py index 37eeabff83..8fd617eea1 100644 --- a/test/units/parsing/yaml/test_loader.py +++ b/test/units/parsing/yaml/test_loader.py @@ -29,6 +29,11 @@ from ansible.compat.tests.mock import patch from ansible.parsing.yaml.loader import AnsibleLoader +try: + from _yaml import ParserError +except ImportError: + from yaml.parser import ParserError + class TestAnsibleLoaderBasic(unittest.TestCase): @@ -123,7 +128,7 @@ class TestAnsibleLoaderBasic(unittest.TestCase): def test_error_conditions(self): stream = StringIO("""{""") loader = AnsibleLoader(stream, 'myfile.yml') - self.assertRaises(loader.get_single_data) + self.assertRaises(ParserError, loader.get_single_data) def test_front_matter(self): stream = StringIO("""---\nfoo: bar""")