def override(self, service_patcher, config_patcher): config_patcher(1, 'ws.call_timeout') service_patcher('test', self)
def test_call_timeout(ws, config_patcher, monkeypatch): monkeypatch.setattr(stopped, 'is_set', Mock(return_value=False)) config_patcher(1, 'ws.call_timeout') pytest.raises(Exception, ws.call, 'foo.bar') assert 'xxx' not in ws._callbacks assert 9 <= stopped.is_set.call_count <= 11
def test_call_timeout(ws, config_patcher, monkeypatch): monkeypatch.setattr(stopped, 'wait', Mock()) config_patcher(1, 'ws.call_timeout') pytest.raises(Exception, ws.call, 'foo.bar') assert 'xxx' not in ws._callbacks assert stopped.wait.call_count == 10