Commit 873f9909 authored by Fantix King's avatar Fantix King

Refs #38, fixed renamed symbols in PY3

parent cecf4efe
......@@ -71,8 +71,12 @@ class SocketConsole(Greenlet):
# __builtin__.__dict__ in the latter case typing
# locals() at the backdoor prompt spews out lots of
# useless stuff
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()
......
......@@ -3,11 +3,17 @@ Various tests for synchronization primitives.
"""
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():
......
......@@ -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 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)
......
......@@ -24,7 +24,10 @@ monkey.patch_all(thread=False)
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:
......@@ -1161,7 +1164,7 @@ class TestInputRaw(greentest.BaseTestCase):
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)
......
......@@ -36,7 +36,10 @@ import greentest
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
......
......@@ -79,5 +79,8 @@ class ThreadTrace(unittest.TestCase):
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)
......@@ -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'))
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
......@@ -539,7 +543,7 @@ class BoundedSemaphoreTests(lock_tests.BoundedSemaphoreTests):
def main():
test.test_support.run_unittest(LockTests, RLockTests, EventTests,
support.run_unittest(LockTests, RLockTests, EventTests,
ConditionAsRLockTests, ConditionTests,
SemaphoreTests, BoundedSemaphoreTests,
ThreadTests,
......
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