Skip to content

Commit

Permalink
Merge pull request gevent#385 from fantix/renamings
Browse files Browse the repository at this point in the history
Refs gevent#38, fixed renamed symbols in PY3
  • Loading branch information
denik committed Feb 8, 2014
2 parents cecf4ef + 873f990 commit b48db7d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 22 deletions.
8 changes: 6 additions & 2 deletions gevent/backdoor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ def _run(self):
# __builtin__.__dict__ in the latter case typing
# locals() at the backdoor prompt spews out lots of
# useless stuff
import __builtin__
console.locals["__builtins__"] = __builtin__
try:
import __builtin__
console.locals["__builtins__"] = __builtin__
except ImportError:
import builtins
console.locals["builtins"] = builtins
console.interact(banner=self.banner)
except SystemExit: # raised by quit()
sys.exc_clear()
Expand Down
10 changes: 8 additions & 2 deletions greentest/lock_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,17 @@
"""
import sys
import time
from thread import start_new_thread, get_ident
try:
from thread import start_new_thread, get_ident
except ImportError:
from _thread import start_new_thread, get_ident
import threading
import unittest

from test import test_support as support
try:
from test import support
except ImportError:
from test import test_support as support


def _wait():
Expand Down
11 changes: 7 additions & 4 deletions greentest/monkey_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@
from gevent import monkey; monkey.patch_all(**kwargs)

from patched_tests_setup import disable_tests_in_source
import test.test_support
test.test_support.is_resource_enabled = lambda *args: True
del test.test_support.use_resources
try:
from test import support
except ImportError:
from test import test_support as support
support.is_resource_enabled = lambda *args: True
del support.use_resources

if sys.version_info[:2] <= (2, 6):
test.test_support.TESTFN += '_%s' % os.getpid()
support.TESTFN += '_%s' % os.getpid()

__file__ = os.path.join(os.getcwd(), test_filename)

Expand Down
7 changes: 5 additions & 2 deletions greentest/test__pywsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
import cgi
import os
import sys
import StringIO
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try:
from wsgiref.validate import validator
except ImportError:
Expand Down Expand Up @@ -1161,7 +1164,7 @@ def make_input(self, data, content_length=None, chunked_input=False):
data = chunk_encode(data)
chunked_input = True

return Input(StringIO.StringIO(data), content_length=content_length, chunked_input=chunked_input)
return Input(StringIO(data), content_length=content_length, chunked_input=chunked_input)

def test_short_post(self):
i = self.make_input("1", content_length=2)
Expand Down
5 changes: 4 additions & 1 deletion greentest/test__refcount.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class Socket(socket):
from gevent import monkey; monkey.patch_all()

from pprint import pformat
from thread import start_new_thread
try:
from thread import start_new_thread
except ImportError:
from _thread import start_new_thread
from time import sleep
import weakref
import gc
Expand Down
7 changes: 5 additions & 2 deletions greentest/test__threading_vs_settrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,8 @@ def test_bootstrap_inner_with_trace(self):


if __name__ == "__main__":
import test.test_support
test.test_support.run_unittest(ThreadTrace)
try:
from test import support
except ImportError:
from test import test_support as support
support.run_unittest(ThreadTrace)
22 changes: 13 additions & 9 deletions greentest/test_threading_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@
setup_5 = '\n'.join(' %s' % line for line in setup_.split('\n'))


import test.test_support
from test.test_support import verbose
try:
from test import support
from test.support import verbose
except ImportError:
from test import test_support as support
from test.test_support import verbose
import random
import re
import sys
Expand Down Expand Up @@ -539,13 +543,13 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):


def main():
test.test_support.run_unittest(LockTests, RLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests,
ThreadTests,
ThreadJoinOnShutdown,
ThreadingExceptionTests,
)
support.run_unittest(LockTests, RLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests,
ThreadTests,
ThreadJoinOnShutdown,
ThreadingExceptionTests,
)

if __name__ == "__main__":
main()

0 comments on commit b48db7d

Please sign in to comment.