mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #11443 from sivel/issue/11441
assertRaises should be given an exception type. Fixes 11441
This commit is contained in:
commit
4c610bb15d
1 changed files with 6 additions and 1 deletions
|
@ -29,6 +29,11 @@ from ansible.compat.tests.mock import patch
|
||||||
|
|
||||||
from ansible.parsing.yaml.loader import AnsibleLoader
|
from ansible.parsing.yaml.loader import AnsibleLoader
|
||||||
|
|
||||||
|
try:
|
||||||
|
from _yaml import ParserError
|
||||||
|
except ImportError:
|
||||||
|
from yaml.parser import ParserError
|
||||||
|
|
||||||
|
|
||||||
class TestAnsibleLoaderBasic(unittest.TestCase):
|
class TestAnsibleLoaderBasic(unittest.TestCase):
|
||||||
|
|
||||||
|
@ -123,7 +128,7 @@ class TestAnsibleLoaderBasic(unittest.TestCase):
|
||||||
def test_error_conditions(self):
|
def test_error_conditions(self):
|
||||||
stream = StringIO("""{""")
|
stream = StringIO("""{""")
|
||||||
loader = AnsibleLoader(stream, 'myfile.yml')
|
loader = AnsibleLoader(stream, 'myfile.yml')
|
||||||
self.assertRaises(loader.get_single_data)
|
self.assertRaises(ParserError, loader.get_single_data)
|
||||||
|
|
||||||
def test_front_matter(self):
|
def test_front_matter(self):
|
||||||
stream = StringIO("""---\nfoo: bar""")
|
stream = StringIO("""---\nfoo: bar""")
|
||||||
|
|
Loading…
Reference in a new issue