summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threading.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-08-18 17:45:09 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-08-18 17:45:09 (GMT)
commitcbae8697599b690effd91be411fe4891ff8b52ad (patch)
tree05686632fffc28f7932d8e2abbc0118b3036ac71 /Lib/test/test_threading.py
parentd8a8972ca955202cb895a48f6d78b17c37f1d1ce (diff)
downloadcpython-cbae8697599b690effd91be411fe4891ff8b52ad.zip
cpython-cbae8697599b690effd91be411fe4891ff8b52ad.tar.gz
cpython-cbae8697599b690effd91be411fe4891ff8b52ad.tar.bz2
backport threading property changes
Diffstat (limited to 'Lib/test/test_threading.py')
-rw-r--r--Lib/test/test_threading.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 7c3d90b..4e87437 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.get_name(), delay * 1e6)
+ self.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.get_name(), 'done'
+ print 'task', self.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.get_name(), self.nrunning.get())
+ self.name, self.nrunning.get())
class ThreadTests(unittest.TestCase):
@@ -172,7 +172,7 @@ class ThreadTests(unittest.TestCase):
worker_saw_exception.set()
t = Worker()
- t.set_daemon(True) # so if this fails, we don't hang Python at shutdown
+ t.daemon = True # so if this fails, we don't hang Python at shutdown
t.start()
if verbose:
print " started worker thread"
@@ -258,7 +258,7 @@ class ThreadTests(unittest.TestCase):
print 'program blocked; aborting'
os._exit(2)
t = threading.Thread(target=killer)
- t.set_daemon(True)
+ t.daemon = True
t.start()
# This is the trace function
@@ -435,7 +435,7 @@ class ThreadingExceptionTests(unittest.TestCase):
def test_daemonize_active_thread(self):
thread = threading.Thread()
thread.start()
- self.assertRaises(RuntimeError, thread.set_daemon, True)
+ self.assertRaises(RuntimeError, setattr, thread, "daemon", True)
def test_main():