From 7cb29cdbec631feec0569d9da6d8b0cdfa1f3c05 Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Fri, 26 Feb 2016 17:59:00 -0800 Subject: [PATCH] Workaround py2.6's StringIO --- test/units/parsing/yaml/test_loader.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/units/parsing/yaml/test_loader.py b/test/units/parsing/yaml/test_loader.py index 48a60b6c53..253ba4d591 100644 --- a/test/units/parsing/yaml/test_loader.py +++ b/test/units/parsing/yaml/test_loader.py @@ -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