@pytest.fixture(autouse=True)
def fast_wait(monkeypatch):
 old_sleep = gevent.sleep
 old_joinall = gevent.joinall
 old_killall = gevent.killall
 def fast_wait(tm):
  return old_sleep(0.1)
 def fast_joinall(*args, **kwargs):
  if ('timeout' in kwargs):
   kwargs['timeout'] = 0.1
  return old_joinall(*args, **kwargs)
 def fast_killall(*args, **kwargs):
  if ('timeout' in kwargs):
   kwargs['timeout'] = 0.1
  return old_killall(*args, **kwargs)
 monkeypatch.setattr(gevent, 'sleep', fast_wait)
 monkeypatch.setattr(gevent, 'joinall', fast_joinall)
 monkeypatch.setattr(gevent, 'killall', fast_killall)

@ pytest . fixture ( autouse = True ) def fast_wait ( monkeypatch ) : old_sleep = gevent . sleep old_joinall = gevent . joinall old_killall = gevent . killall def fast_wait ( tm ) : return old_sleep ( 0.1 ) def fast_joinall ( * args , ** kwargs ) : if ( 'timeout' in kwargs ) : kwargs [ 'timeout' ] = 0.1 return old_joinall ( * args , ** kwargs ) def fast_killall ( * args , ** kwargs ) : if ( 'timeout' in kwargs ) : kwargs [ 'timeout' ] = 0.1 return old_killall ( * args , ** kwargs ) monkeypatch . setattr ( gevent , 'sleep' , fast_wait ) monkeypatch . setattr ( gevent , 'joinall' , fast_joinall ) monkeypatch . setattr ( gevent , 'killall' , fast_killall )
stub out gevent calls that take timeouts to wait briefly .