Commit d48e4d86 authored by Denis Bilenko's avatar Denis Bilenko

Merge pull request #357 from fantix/xrange

Use six.xrange in tests.
parents 567277f2 886ae3de
import sys import sys
from gevent.hub import PY3
PY3 = sys.version_info[0] >= 3
if PY3: if PY3:
advance_iterator = next advance_iterator = next
...@@ -18,6 +19,7 @@ if PY3: ...@@ -18,6 +19,7 @@ if PY3:
print_ = getattr(builtins, "print") print_ = getattr(builtins, "print")
del builtins del builtins
xrange = range
else: else:
def exec_(code, globs=None, locs=None): def exec_(code, globs=None, locs=None):
...@@ -31,3 +33,5 @@ else: ...@@ -31,3 +33,5 @@ else:
elif locs is None: elif locs is None:
locs = globs locs = globs
exec("""exec code in globs, locs""") exec("""exec code in globs, locs""")
xrange = xrange
...@@ -2,6 +2,7 @@ import greentest ...@@ -2,6 +2,7 @@ import greentest
import gevent import gevent
from gevent import socket from gevent import socket
from gevent import backdoor from gevent import backdoor
from six import xrange
def read_until(conn, postfix): def read_until(conn, postfix):
......
import greentest import greentest
import gevent import gevent
from gevent.event import Event, AsyncResult from gevent.event import Event, AsyncResult
from six import xrange
DELAY = 0.01 DELAY = 0.01
......
import gevent import gevent
import greentest import greentest
from six import xrange
class appender(object): class appender(object):
......
...@@ -8,6 +8,7 @@ from time import time ...@@ -8,6 +8,7 @@ from time import time
import gevent import gevent
import gevent.socket as gevent_socket import gevent.socket as gevent_socket
from util import log from util import log
from six import xrange
resolver = gevent.get_hub().resolver resolver = gevent.get_hub().resolver
......
import sys import sys
from six import xrange
if 'runtestcase' in sys.argv[1:]: if 'runtestcase' in sys.argv[1:]:
......
import os import os
import gevent import gevent
from gevent import core from gevent import core
from six import xrange
for count in xrange(2): for count in xrange(2):
......
...@@ -3,6 +3,7 @@ from contextlib import contextmanager ...@@ -3,6 +3,7 @@ from contextlib import contextmanager
import gevent import gevent
from gevent.event import Event from gevent.event import Event
from time import time from time import time
from six import xrange
SMALL = 0.1 SMALL = 0.1
......
...@@ -7,6 +7,7 @@ import threading ...@@ -7,6 +7,7 @@ import threading
import time import time
import unittest import unittest
import test_support import test_support
from six import xrange
QUEUE_SIZE = 5 QUEUE_SIZE = 5
......
# testing gevent's Event, Lock, RLock, Semaphore, BoundedSemaphore with standard test_threading # testing gevent's Event, Lock, RLock, Semaphore, BoundedSemaphore with standard test_threading
from __future__ import with_statement from __future__ import with_statement
from six import xrange
setup_ = '''from gevent import monkey; monkey.patch_all() setup_ = '''from gevent import monkey; monkey.patch_all()
from gevent.event import Event from gevent.event import Event
......
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