Don't require swift be installed to have passing manager tests

Change-Id: I9a1ebec645ced755aece8e28452f51488c2b776c
Related-Change: I09143ae20bd6249083c0b80cdaa9d561e6abb301
This commit is contained in:
Tim Burke 2021-03-18 16:35:05 -07:00
parent ec37893b82
commit d54083771f

View File

@ -1725,6 +1725,7 @@ class TestManager(unittest.TestCase):
self.assertTrue(server.server in servers[:2])
def test_iter(self):
with mock.patch.object(manager, 'find_executable', lambda x: x):
m = manager.Manager(['all'])
self.assertEqual(len(list(m)), len(manager.ALL_SERVERS))
for server in m:
@ -2329,8 +2330,8 @@ class TestManager(unittest.TestCase):
return 0
m = manager.Manager(['*-server'])
self.assertEqual(len(m.servers), 4)
expected_servers = set([server.server for server in m.servers])
self.assertEqual(len(expected_servers), 4)
for server in expected_servers:
self.assertIn(server, manager.GRACEFUL_SHUTDOWN_SERVERS)
@ -2347,8 +2348,9 @@ class TestManager(unittest.TestCase):
actual_servers.update([server.server for server in m.servers])
self.assertEqual(expected_servers, actual_servers)
with mock.patch.object(manager, 'find_executable', lambda x: x):
do_test(graceful=True)
do_test(graceful=False) # graceful is forced regardless of the kwarg
do_test(graceful=False) # graceful is forced regardless
@mock.patch.object(manager, 'verify_server',
side_effect=lambda server: 'error' not in server)