mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup. * PEP 8 W293 whitespace cleanup. * Fix whitespace issue from recent PR.
This commit is contained in:
@@ -120,7 +120,7 @@ class TestGalaxy(unittest.TestCase):
|
||||
with patch.object(ansible.cli.CLI, "execute", return_value=None) as mock_ex:
|
||||
with patch.object(ansible.cli.CLI, "run", return_value=None) as mock_run:
|
||||
gc.run()
|
||||
|
||||
|
||||
# testing
|
||||
self.assertEqual(mock_run.call_count, 1)
|
||||
self.assertTrue(isinstance(gc.api, ansible.galaxy.api.GalaxyAPI))
|
||||
|
||||
@@ -135,7 +135,7 @@ class GCPAuthTestCase(unittest.TestCase):
|
||||
require_valid_json=False,
|
||||
check_libcloud=False)
|
||||
self.assertTrue(is_valid)
|
||||
|
||||
|
||||
@mock.patch('ansible.module_utils.gcp._get_gcp_environ_var',
|
||||
side_effect=fake_get_gcp_environ_var)
|
||||
def test_get_gcp_environment_credentials(self, mockobj):
|
||||
@@ -144,7 +144,7 @@ class GCPAuthTestCase(unittest.TestCase):
|
||||
actual = _get_gcp_environment_credentials(None, None, None)
|
||||
expected = tuple(['gce-email', None, None])
|
||||
self.assertEqual(expected, actual)
|
||||
|
||||
|
||||
fake_env_data = {'GCE_PEM_FILE_PATH': '/path/to/pem.pem'}
|
||||
expected = tuple([None, '/path/to/pem.pem', None])
|
||||
actual = _get_gcp_environment_credentials(None, None, None)
|
||||
|
||||
@@ -176,10 +176,10 @@ class TestModuleUtilsBasic(ModuleTestCase):
|
||||
return ("Bar", "2", "Two")
|
||||
else:
|
||||
return ("", "", "")
|
||||
|
||||
|
||||
with patch('platform.linux_distribution', side_effect=_dist):
|
||||
self.assertEqual(get_distribution(), "Bar")
|
||||
|
||||
|
||||
with patch('platform.linux_distribution', side_effect=Exception("boo")):
|
||||
with patch('platform.dist', return_value=("bar", "2", "Two")):
|
||||
self.assertEqual(get_distribution(), "Bar")
|
||||
@@ -699,7 +699,7 @@ class TestModuleUtilsBasic(ModuleTestCase):
|
||||
self.assertRaises(SystemExit, am.set_context_if_different, '/path/to/file', ['foo_u', 'foo_r', 'foo_t', 's0'], True)
|
||||
|
||||
am.is_special_selinux_path = MagicMock(return_value=(True, ['sp_u', 'sp_r', 'sp_t', 's0']))
|
||||
|
||||
|
||||
with patch('selinux.lsetfilecon', return_value=0) as m:
|
||||
self.assertEqual(am.set_context_if_different('/path/to/file', ['foo_u', 'foo_r', 'foo_t', 's0'], False), True)
|
||||
m.assert_called_with('/path/to/file', 'sp_u:sp_r:sp_t:s0')
|
||||
|
||||
@@ -52,7 +52,7 @@ class TestGCETag(unittest.TestCase):
|
||||
want = ['one']
|
||||
got = _get_changed_items(tags_to_add, existing_tags)
|
||||
self.assertEqual(want, got)
|
||||
|
||||
|
||||
# simulate removing tags
|
||||
# specifying one tag on right that doesn't exist
|
||||
tags_to_remove = ['one', 'two']
|
||||
@@ -63,6 +63,6 @@ class TestGCETag(unittest.TestCase):
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -114,12 +114,12 @@ class MockLPass(LPass):
|
||||
|
||||
|
||||
class DisconnectedMockLPass(MockLPass):
|
||||
|
||||
|
||||
_mock_disconnected = True
|
||||
|
||||
|
||||
class LoggedOutMockLPass(MockLPass):
|
||||
|
||||
|
||||
_mock_logged_out = True
|
||||
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ class TestStrategyBase(unittest.TestCase):
|
||||
mock_tqm._failed_hosts = []
|
||||
mock_tqm._unreachable_hosts = []
|
||||
self.assertEqual(strategy_base.get_hosts_remaining(play=mock_play), mock_hosts)
|
||||
|
||||
|
||||
mock_tqm._failed_hosts = ["host01"]
|
||||
self.assertEqual(strategy_base.get_hosts_remaining(play=mock_play), mock_hosts[1:])
|
||||
self.assertEqual(strategy_base.get_failed_hosts(play=mock_play), [mock_hosts[0]])
|
||||
@@ -186,7 +186,7 @@ class TestStrategyBase(unittest.TestCase):
|
||||
mock_inventory = MagicMock()
|
||||
mock_options = MagicMock()
|
||||
mock_options.module_path = None
|
||||
|
||||
|
||||
tqm = TaskQueueManager(
|
||||
inventory=mock_inventory,
|
||||
variable_manager=mock_var_manager,
|
||||
@@ -210,7 +210,7 @@ class TestStrategyBase(unittest.TestCase):
|
||||
self.assertEqual(strategy_base._pending_results, 3)
|
||||
finally:
|
||||
tqm.cleanup()
|
||||
|
||||
|
||||
|
||||
def test_strategy_base_process_pending_results(self):
|
||||
mock_tqm = MagicMock()
|
||||
@@ -240,7 +240,7 @@ class TestStrategyBase(unittest.TestCase):
|
||||
|
||||
mock_tqm._stats = MagicMock()
|
||||
mock_tqm._stats.increment.return_value = None
|
||||
|
||||
|
||||
mock_play = MagicMock()
|
||||
|
||||
mock_host = MagicMock()
|
||||
|
||||
@@ -103,7 +103,7 @@ class TestTemplar(unittest.TestCase):
|
||||
def test_template_jinja2_extensions(self):
|
||||
fake_loader = DictDataLoader({})
|
||||
templar = Templar(loader=fake_loader)
|
||||
|
||||
|
||||
old_exts = C.DEFAULT_JINJA2_EXTENSIONS
|
||||
try:
|
||||
C.DEFAULT_JINJA2_EXTENSIONS = "foo,bar"
|
||||
|
||||
Reference in New Issue
Block a user