Workaround py2.6's StringIO

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

View file

@ -36,6 +36,13 @@ except ImportError:
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):
def setUp(self):
@ -155,7 +162,7 @@ class TestAnsibleLoaderBasic(unittest.TestCase):
class TestAnsibleLoaderPlay(unittest.TestCase):
def setUp(self):
stream = StringIO(u"""
stream = NameStringIO(u"""
- hosts: localhost
vars:
number: 1