Commit b48db7d1 authored by Denis Bilenko's avatar Denis Bilenko

Merge pull request #385 from fantix/renamings

Refs #38, fixed renamed symbols in PY3
parents cecf4efe 873f9909
...@@ -71,8 +71,12 @@ class SocketConsole(Greenlet): ...@@ -71,8 +71,12 @@ class SocketConsole(Greenlet):
# __builtin__.__dict__ in the latter case typing # __builtin__.__dict__ in the latter case typing
# locals() at the backdoor prompt spews out lots of # locals() at the backdoor prompt spews out lots of
# useless stuff # useless stuff
import __builtin__ try:
console.locals["__builtins__"] = __builtin__ import __builtin__
console.locals["__builtins__"] = __builtin__
except ImportError:
import builtins
console.locals["builtins"] = builtins
console.interact(banner=self.banner) console.interact(banner=self.banner)
except SystemExit: # raised by quit() except SystemExit: # raised by quit()
sys.exc_clear() sys.exc_clear()
......
...@@ -3,11 +3,17 @@ Various tests for synchronization primitives. ...@@ -3,11 +3,17 @@ Various tests for synchronization primitives.
""" """
import sys import sys
import time 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 threading
import unittest 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(): def _wait():
......
...@@ -17,12 +17,15 @@ print('Running with patch_all(%s): %s' % (','.join('%s=%r' % x for x in kwargs.i ...@@ -17,12 +17,15 @@ print('Running with patch_all(%s): %s' % (','.join('%s=%r' % x for x in kwargs.i
from gevent import monkey; monkey.patch_all(**kwargs) from gevent import monkey; monkey.patch_all(**kwargs)
from patched_tests_setup import disable_tests_in_source from patched_tests_setup import disable_tests_in_source
import test.test_support try:
test.test_support.is_resource_enabled = lambda *args: True from test import support
del test.test_support.use_resources 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): 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) __file__ = os.path.join(os.getcwd(), test_filename)
......
...@@ -24,7 +24,10 @@ monkey.patch_all(thread=False) ...@@ -24,7 +24,10 @@ monkey.patch_all(thread=False)
import cgi import cgi
import os import os
import sys import sys
import StringIO try:
from StringIO import StringIO
except ImportError:
from io import StringIO
try: try:
from wsgiref.validate import validator from wsgiref.validate import validator
except ImportError: except ImportError:
...@@ -1161,7 +1164,7 @@ class TestInputRaw(greentest.BaseTestCase): ...@@ -1161,7 +1164,7 @@ class TestInputRaw(greentest.BaseTestCase):
data = chunk_encode(data) data = chunk_encode(data)
chunked_input = True 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): def test_short_post(self):
i = self.make_input("1", content_length=2) i = self.make_input("1", content_length=2)
......
...@@ -36,7 +36,10 @@ import greentest ...@@ -36,7 +36,10 @@ import greentest
from gevent import monkey; monkey.patch_all() from gevent import monkey; monkey.patch_all()
from pprint import pformat 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 from time import sleep
import weakref import weakref
import gc import gc
......
...@@ -79,5 +79,8 @@ class ThreadTrace(unittest.TestCase): ...@@ -79,5 +79,8 @@ class ThreadTrace(unittest.TestCase):
if __name__ == "__main__": if __name__ == "__main__":
import test.test_support try:
test.test_support.run_unittest(ThreadTrace) from test import support
except ImportError:
from test import test_support as support
support.run_unittest(ThreadTrace)
...@@ -31,8 +31,12 @@ setup_4 = '\n'.join(' %s' % line for line in setup_.split('\n')) ...@@ -31,8 +31,12 @@ setup_4 = '\n'.join(' %s' % line for line in setup_.split('\n'))
setup_5 = '\n'.join(' %s' % line for line in setup_.split('\n')) setup_5 = '\n'.join(' %s' % line for line in setup_.split('\n'))
import test.test_support try:
from test.test_support import verbose 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 random
import re import re
import sys import sys
...@@ -539,13 +543,13 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests): ...@@ -539,13 +543,13 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
def main(): def main():
test.test_support.run_unittest(LockTests, RLockTests, EventTests, support.run_unittest(LockTests, RLockTests, EventTests,
ConditionAsRLockTests, ConditionTests, ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests, SemaphoreTests, BoundedSemaphoreTests,
ThreadTests, ThreadTests,
ThreadJoinOnShutdown, ThreadJoinOnShutdown,
ThreadingExceptionTests, ThreadingExceptionTests,
) )
if __name__ == "__main__": if __name__ == "__main__":
main() main()
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