Commit cf8bd97d authored by Denis Bilenko's avatar Denis Bilenko

add a few more tests

parent 854d31b9
from gevent import GreenletExit
assert issubclass(GreenletExit, BaseException)
assert not issubclass(GreenletExit, Exception)
from __future__ import with_statement
import gevent
import gevent.core
import time
import thread
hub = gevent.get_hub()
watcher = hub.loop.async()
gevent.spawn_later(0.1, thread.start_new_thread, watcher.send, ())
start = time.time()
with gevent.Timeout(0.3):
hub.wait(watcher)
print 'Watcher %r reacted after %.6f seconds' % (watcher, time.time() - start - 0.1)
import os
import sys
import gevent
import subprocess
if sys.argv[1:] == []:
os.environ['GEVENT_BACKEND'] = 'select'
popen = subprocess.Popen([sys.executable, 'test__environ.py', '1'])
assert popen.wait() == 0, popen.poll()
else:
hub = gevent.get_hub()
assert hub.loop.backend == 'select', hub.loop.backend
import gevent
def func():
pass
a = gevent.spawn(func)
b = gevent.spawn(func)
gevent.joinall([a, b, a])
from gevent.core import loop
count = 0
def incr():
global count
count += 1
loop = loop()
loop.callback().start(incr)
loop.run()
assert count == 1, count
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment