Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

cytora / gevent   python

Repository URL to install this package:

Version: 1.4.0 

/ tests / test__core_callback.py

import gevent
from gevent.hub import get_hub

called = []


def f():
    called.append(1)


def main():
    loop = get_hub().loop
    x = loop.run_callback(f)

    assert x, x
    gevent.sleep(0)
    assert called == [1], called
    assert not x, (x, bool(x))

    x = loop.run_callback(f)
    assert x, x
    x.stop()
    assert not x, x
    gevent.sleep(0)
    assert called == [1], called
    assert not x, x


if __name__ == '__main__':
    called[:] = []
    main()