

def test_no_service(self):
    oldCallWhenRunning = reactor.callWhenRunning

    class MockCallWhenRunning(object):

        def __init__(self):
            self.call_count = 0

        def __call__(self, *args, **kwargs):
            self.call_count += 1
    mockCallWhenRunning = MockCallWhenRunning()
    try:
        reactor.callWhenRunning = mockCallWhenRunning
        service = self._make_service(['--local-ivo', 'ivo://comet/test'])
    finally:
        reactor.callWhenRunning = oldCallWhenRunning
    self.assertEqual(len(service.namedServices), 0)
    self.assertEqual(mockCallWhenRunning.call_count, 2)

dataset/ETHPy150Open jdswinbank/Comet/comet/service/test/test_broker.py ServiceTestCase.test_no_service/original