give the threading API PEP 8 names
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index b974715..db6b0d7 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -34,7 +34,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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():