1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Workaround py2.6's StringIO

This commit is contained in:
Toshio Kuratomi 2016-02-26 17:59:00 -08:00
parent e01b6ad6b4
commit 7cb29cdbec

View file

@ -36,6 +36,13 @@ except ImportError:
from yaml.parser import ParserError from yaml.parser import ParserError
class NameStringIO(StringIO):
"""In py2.6, StringIO doesn't let you set name because a baseclass has it
as readonly property"""
name = None
def __init__(self, *args, **kwargs):
super(NameStringIO, self).__init__(*args, **kwargs)
class TestAnsibleLoaderBasic(unittest.TestCase): class TestAnsibleLoaderBasic(unittest.TestCase):
def setUp(self): def setUp(self):
@ -155,7 +162,7 @@ class TestAnsibleLoaderBasic(unittest.TestCase):
class TestAnsibleLoaderPlay(unittest.TestCase): class TestAnsibleLoaderPlay(unittest.TestCase):
def setUp(self): def setUp(self):
stream = StringIO(u""" stream = NameStringIO(u"""
- hosts: localhost - hosts: localhost
vars: vars:
number: 1 number: 1