mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-28 21:31:26 -07:00
Applied some stashed fixes.
* Fixed file.close() typo in test_vault_editor * Updated unicode.py to redefine basestring properly in python3 and fixed a couple missed py27 specific code. * Realized the patch in test_data_loader was still failing cause we are passing the string 'builtins.open' and not actually using it in that file and soe instead of failing in py34 it would fail in py27.
This commit is contained in:
parent
f3fed01a7e
commit
3e25f633fe
3 changed files with 20 additions and 12 deletions
|
@ -19,7 +19,7 @@
|
|||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
from six.moves import builtins
|
||||
from six import PY2
|
||||
from yaml.scanner import ScannerError
|
||||
|
||||
from ansible.compat.tests import unittest
|
||||
|
@ -80,6 +80,11 @@ class TestDataLoaderWithVault(unittest.TestCase):
|
|||
3135306561356164310a343937653834643433343734653137383339323330626437313562306630
|
||||
3035
|
||||
"""
|
||||
with patch('builtins.open', mock_open(read_data=vaulted_data)):
|
||||
if PY2:
|
||||
builtins_name = '__builtin__'
|
||||
else:
|
||||
builtins_name = 'builtins'
|
||||
|
||||
with patch(builtins_name + '.open', mock_open(read_data=vaulted_data)):
|
||||
output = self._loader.load_from_file('dummy_vault.txt')
|
||||
self.assertEqual(output, dict(foo='bar'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue