Commits

Denis Bilenko committed 31ce5c3

add a few more tests

Comments (0)

Files changed (5)

greentest/test__GreenletExit.py

+from gevent import GreenletExit
+
+assert issubclass(GreenletExit, BaseException)
+assert not issubclass(GreenletExit, Exception)

greentest/test__core_async.py

+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)

greentest/test__environ.py

+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

greentest/test__joinall.py

+import gevent
+
+def func():
+    pass
+
+
+a = gevent.spawn(func)
+b = gevent.spawn(func)
+
+
+gevent.joinall([a, b, a])

greentest/test__loop_callback.py

+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