diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-06-11 17:27:50 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-06-11 17:27:50 +0000 |
commit | 0fbcf6945584b1b2a7564680de50c062fc4dce1c (patch) | |
tree | 44d27858990999b69379b50abc5ad163789db6fc /Lib/test/test_threading.py | |
parent | 32c2e41c82c2d0f967a0f435f88168583218f262 (diff) | |
download | cpython-git-0fbcf6945584b1b2a7564680de50c062fc4dce1c.tar.gz |
give the threading API PEP 8 names
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r-- | Lib/test/test_threading.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index b9747151b0..db6b0d7504 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -34,7 +34,7 @@ class TestThread(threading.Thread): delay = random.random() / 10000.0 if verbose: print 'task %s will run for %.1f usec' % ( - self.getName(), delay * 1e6) + self.get_name(), delay * 1e6) with self.sema: with self.mutex: @@ -45,14 +45,14 @@ class TestThread(threading.Thread): time.sleep(delay) if verbose: - print 'task', self.getName(), 'done' + print 'task', self.get_name(), 'done' with self.mutex: self.nrunning.dec() self.testcase.assert_(self.nrunning.get() >= 0) if verbose: print '%s is finished. %d tasks are running' % ( - self.getName(), self.nrunning.get()) + self.get_name(), self.nrunning.get()) class ThreadTests(unittest.TestCase): @@ -73,7 +73,7 @@ class ThreadTests(unittest.TestCase): for i in range(NUMTASKS): t = TestThread("<thread %d>"%i, self, sema, mutex, numrunning) threads.append(t) - self.failUnlessEqual(t.getIdent(), None) + self.failUnlessEqual(t.get_ident(), None) self.assert_(re.match('<TestThread\(.*, initial\)>', repr(t))) t.start() @@ -81,8 +81,8 @@ class ThreadTests(unittest.TestCase): print 'waiting for all tasks to complete' for t in threads: t.join(NUMTASKS) - self.assert_(not t.isAlive()) - self.failIfEqual(t.getIdent(), 0) + self.assert_(not t.is_alive()) + self.failIfEqual(t.get_ident(), 0) self.assert_(re.match('<TestThread\(.*, \w+ -?\d+\)>', repr(t))) if verbose: print 'all tasks done' @@ -172,7 +172,7 @@ class ThreadTests(unittest.TestCase): worker_saw_exception.set() t = Worker() - t.setDaemon(True) # so if this fails, we don't hang Python at shutdown + t.set_daemon(True) # so if this fails, we don't hang Python at shutdown t.start() if verbose: print " started worker thread" @@ -258,12 +258,12 @@ class ThreadTests(unittest.TestCase): print 'program blocked; aborting' os._exit(2) t = threading.Thread(target=killer) - t.setDaemon(True) + t.set_daemon(True) t.start() # This is the trace function def func(frame, event, arg): - threading.currentThread() + threading.current_thread() return func sys.settrace(func) @@ -348,8 +348,8 @@ class ThreadingExceptionTests(unittest.TestCase): self.assertRaises(ValueError, threading.Semaphore, value = -sys.maxint) def test_joining_current_thread(self): - currentThread = threading.currentThread() - self.assertRaises(RuntimeError, currentThread.join); + current_thread = threading.current_thread() + self.assertRaises(RuntimeError, current_thread.join); def test_joining_inactive_thread(self): thread = threading.Thread() @@ -358,7 +358,7 @@ class ThreadingExceptionTests(unittest.TestCase): def test_daemonize_active_thread(self): thread = threading.Thread() thread.start() - self.assertRaises(RuntimeError, thread.setDaemon, True) + self.assertRaises(RuntimeError, thread.set_daemon, True) def test_main(): |