mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-21 03:09:04 +00:00
Reformat everything.
This commit is contained in:
parent
3f2213791a
commit
340ff8586d
1008 changed files with 61301 additions and 58309 deletions
|
|
@ -20,7 +20,7 @@ from .FakeAnsibleModule import FakeAnsibleModule
|
|||
@pytest.fixture
|
||||
def fake_ansible_module(request):
|
||||
"""Returns fake AnsibleModule with fake module params."""
|
||||
if hasattr(request, 'param'):
|
||||
if hasattr(request, "param"):
|
||||
return FakeAnsibleModule(request.param)
|
||||
else:
|
||||
params = {
|
||||
|
|
@ -42,12 +42,14 @@ def XenAPI():
|
|||
|
||||
# First we use importlib.import_module() to import the module and assign
|
||||
# it to a local symbol.
|
||||
fake_xenapi = importlib.import_module('ansible_collections.community.general.tests.unit.plugins.module_utils.xenserver.FakeXenAPI')
|
||||
fake_xenapi = importlib.import_module(
|
||||
"ansible_collections.community.general.tests.unit.plugins.module_utils.xenserver.FakeXenAPI"
|
||||
)
|
||||
|
||||
# Now we populate Python module cache with imported fake module using the
|
||||
# original module name (XenAPI). That way, any 'import XenAPI' statement
|
||||
# will just load already imported fake module from the cache.
|
||||
sys.modules['XenAPI'] = fake_xenapi
|
||||
sys.modules["XenAPI"] = fake_xenapi
|
||||
|
||||
return fake_xenapi
|
||||
|
||||
|
|
@ -83,7 +85,7 @@ def mock_xenapi_failure(XenAPI, mocker):
|
|||
child_mock.side_effect = self.side_effect
|
||||
return child_mock
|
||||
|
||||
mocked_xenapi = mocker.patch.object(XenAPI.Session, 'xenapi', new=MagicMockSideEffect(), create=True)
|
||||
mocked_xenapi = mocker.patch.object(XenAPI.Session, "xenapi", new=MagicMockSideEffect(), create=True)
|
||||
mocked_xenapi.side_effect = XenAPI.Failure(fake_error_msg)
|
||||
|
||||
return mocked_xenapi, fake_error_msg
|
||||
|
|
@ -92,10 +94,10 @@ def mock_xenapi_failure(XenAPI, mocker):
|
|||
@pytest.fixture
|
||||
def fixture_data_from_file(request):
|
||||
"""Loads fixture data from files."""
|
||||
if not hasattr(request, 'param'):
|
||||
if not hasattr(request, "param"):
|
||||
return {}
|
||||
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||
fixture_path = os.path.join(os.path.dirname(__file__), "fixtures")
|
||||
fixture_data = {}
|
||||
|
||||
if isinstance(request.param, str):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue