diff options
Diffstat (limited to 'python/helpers/pydev/tests_python/test_additional_thread_info.py')
-rw-r--r-- | python/helpers/pydev/tests_python/test_additional_thread_info.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/python/helpers/pydev/tests_python/test_additional_thread_info.py b/python/helpers/pydev/tests_python/test_additional_thread_info.py index 6ae260d6a658..71dc35243257 100644 --- a/python/helpers/pydev/tests_python/test_additional_thread_info.py +++ b/python/helpers/pydev/tests_python/test_additional_thread_info.py @@ -1,10 +1,21 @@ import sys import os +import pydev_monkey sys.path.insert(0, os.path.split(os.path.split(__file__)[0])[0]) from pydevd_constants import Null import unittest +try: + import thread +except: + import _thread as thread + +try: + xrange +except: + xrange = range + #======================================================================================================================= # TestCase #======================================================================================================================= @@ -40,10 +51,7 @@ class TestCase(unittest.TestCase): def testStartNewThread(self): - import pydevd - import thread - original = thread.start_new_thread - thread.start_new_thread = pydevd.pydev_start_new_thread + pydev_monkey.patch_thread_modules() try: found = {} def function(a, b, *args, **kwargs): @@ -62,15 +70,11 @@ class TestCase(unittest.TestCase): self.assertEqual({'a': 1, 'b': 2, 'args': (3, 4), 'kwargs': {'e': 2, 'd': 1}}, found) finally: - thread.start_new_thread = original + pydev_monkey.undo_patch_thread_modules() def testStartNewThread2(self): - import pydevd - import thread - - original = thread.start_new_thread - thread.start_new_thread = pydevd.pydev_start_new_thread + pydev_monkey.patch_thread_modules() try: found = {} @@ -101,7 +105,7 @@ class TestCase(unittest.TestCase): self.assertEqual({'a': 1, 'b': 2, 'args': (3, 4), 'kwargs': {'e': 2, 'd': 1}}, found) finally: - thread.start_new_thread = original + pydev_monkey.undo_patch_thread_modules() #======================================================================================================================= |