Don't use 'from ansible.module_utils import foo' style here as it breaks (#15756)

py.test"
This commit is contained in:
Robin Roth 2016-05-14 06:09:13 +02:00 committed by Toshio Kuratomi
parent 0ad0b3d83b
commit 03e7f54071

View file

@ -30,8 +30,7 @@ from ansible.compat.tests.mock import call, MagicMock, Mock, patch, sentinel
from units.mock.procenv import swap_stdin_and_argv from units.mock.procenv import swap_stdin_and_argv
from ansible.module_utils import basic import ansible.module_utils.basic
from ansible.module_utils.basic import AnsibleModule
class OpenBytesIO(BytesIO): class OpenBytesIO(BytesIO):
"""BytesIO with dummy close() method """BytesIO with dummy close() method
@ -67,8 +66,8 @@ class TestAnsibleModuleRunCommand(unittest.TestCase):
self.stdin_swap = swap_stdin_and_argv(stdin_data=args) self.stdin_swap = swap_stdin_and_argv(stdin_data=args)
self.stdin_swap.__enter__() self.stdin_swap.__enter__()
basic._ANSIBLE_ARGS = None ansible.module_utils.basic._ANSIBLE_ARGS = None
self.module = AnsibleModule(argument_spec=dict()) self.module = ansible.module_utils.basic.AnsibleModule(argument_spec=dict())
self.module.fail_json = MagicMock(side_effect=SystemExit) self.module.fail_json = MagicMock(side_effect=SystemExit)
self.os = patch('ansible.module_utils.basic.os').start() self.os = patch('ansible.module_utils.basic.os').start()