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:
parent
e01b6ad6b4
commit
7cb29cdbec
1 changed files with 8 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue