From 0f466bb75ffdfa443a3b2d73f8fd1707a0b5fd96 Mon Sep 17 00:00:00 2001 From: Abhijeet Kasurde Date: Thu, 5 Dec 2024 14:52:12 -0800 Subject: test: Remove dead code (#84436) Signed-off-by: Abhijeet Kasurde --- test/units/parsing/yaml/test_loader.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'test/units/parsing/yaml/test_loader.py') diff --git a/test/units/parsing/yaml/test_loader.py b/test/units/parsing/yaml/test_loader.py index 75ad7c4af3..c3a2a9bce6 100644 --- a/test/units/parsing/yaml/test_loader.py +++ b/test/units/parsing/yaml/test_loader.py @@ -36,15 +36,6 @@ from yaml.parser import ParserError from yaml.scanner import ScannerError -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 test_parse_number(self): @@ -205,7 +196,7 @@ class TestAnsibleLoaderVault(unittest.TestCase, YamlTestUtils): return tagged_vaulted_var def _build_stream(self, yaml_text): - stream = NameStringIO(yaml_text) + stream = StringIO(yaml_text) stream.name = 'my.yml' return stream @@ -226,13 +217,9 @@ class TestAnsibleLoaderVault(unittest.TestCase, YamlTestUtils): def test_embedded_vault_from_dump(self): avu = AnsibleVaultEncryptedUnicode.from_plaintext('setec astronomy', self.vault, self.vault_secret) - blip = {'stuff1': [{'a dict key': 24}, - {'shhh-ssh-secrets': avu, - 'nothing to see here': 'move along'}], - 'another key': 24.1} blip = ['some string', 'another string', avu] - stream = NameStringIO() + stream = StringIO() self._dump_stream(blip, stream, dumper=AnsibleDumper) @@ -244,7 +231,7 @@ class TestAnsibleLoaderVault(unittest.TestCase, YamlTestUtils): data_from_yaml = loader.get_data() - stream2 = NameStringIO(u'') + stream2 = StringIO(u'') # verify we can dump the object again self._dump_stream(data_from_yaml, stream2, dumper=AnsibleDumper) @@ -294,7 +281,7 @@ class TestAnsibleLoaderVault(unittest.TestCase, YamlTestUtils): class TestAnsibleLoaderPlay(unittest.TestCase): def setUp(self): - stream = NameStringIO(u""" + stream = StringIO(u""" - hosts: localhost vars: number: 1 -- cgit v1.2.3