Merge branch 'upgrading_sleekxmpp_1_1_11' into develop_sleek
This commit is contained in:
commit
a1d988fed5
2 changed files with 19 additions and 4 deletions
|
@ -18,7 +18,18 @@ from sleekxmpp.util.misc_ops import bytes, unicode, hashes, hash, \
|
||||||
# Standardize import of Queue class:
|
# Standardize import of Queue class:
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
if 'gevent' in sys.modules:
|
|
||||||
|
def _gevent_threads_enabled():
|
||||||
|
if not 'gevent' in sys.modules:
|
||||||
|
return False
|
||||||
|
try:
|
||||||
|
from gevent import thread as green_thread
|
||||||
|
thread = __import__('thread')
|
||||||
|
return thread.LockType is green_thread.LockType
|
||||||
|
except ImportError:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if _gevent_threads_enabled():
|
||||||
import gevent.queue as queue
|
import gevent.queue as queue
|
||||||
Queue = queue.JoinableQueue
|
Queue = queue.JoinableQueue
|
||||||
else:
|
else:
|
||||||
|
|
10
testall.py
10
testall.py
|
@ -1,7 +1,11 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os
|
|
||||||
import sys
|
import sys
|
||||||
|
if len(sys.argv)>1 and sys.argv[1].lower() == 'gevent':
|
||||||
|
from gevent import monkey
|
||||||
|
monkey.patch_all()
|
||||||
|
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
import unittest
|
import unittest
|
||||||
import distutils.core
|
import distutils.core
|
||||||
|
@ -57,7 +61,7 @@ class TestCommand(distutils.core.Command):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
result = run_tests()
|
result = run_tests()
|
||||||
print("<tests %s ran='%s' errors='%s' fails='%s' success='%s' />" % (
|
print("<tests %s ran='%s' errors='%s' fails='%s' success='%s' gevent_enabled=%s/>" % (
|
||||||
"xmlns='http//andyet.net/protocol/tests'",
|
"xmlns='http//andyet.net/protocol/tests'",
|
||||||
result.testsRun, len(result.errors),
|
result.testsRun, len(result.errors),
|
||||||
len(result.failures), result.wasSuccessful()))
|
len(result.failures), result.wasSuccessful(),'gevent' in sys.modules))
|
||||||
|
|
Loading…
Reference in a new issue