[Python-3000-checkins] r62034 - python/branches/py3k/Lib/test/test_threading.py
jeffrey.yasskin
python-3000-checkins at python.org
Sat Mar 29 06:06:53 CET 2008
Author: jeffrey.yasskin
Date: Sat Mar 29 06:06:52 2008
New Revision: 62034
Modified:
python/branches/py3k/Lib/test/test_threading.py
Log:
Update test_threading with a couple changes from trunk that got lost due, I
presume, to merge conflicts.
Modified: python/branches/py3k/Lib/test/test_threading.py
==============================================================================
--- python/branches/py3k/Lib/test/test_threading.py (original)
+++ python/branches/py3k/Lib/test/test_threading.py Sat Mar 29 06:06:52 2008
@@ -32,7 +32,8 @@
def run(self):
delay = random.random() / 10000.0
if verbose:
- print('task', self.getName(), 'will run for', delay, 'sec')
+ print('task %s will run for %.1f usec' %
+ (self.getName(), delay * 1e6))
with self.sema:
with self.mutex:
@@ -49,7 +50,7 @@
self.testcase.assert_(self.nrunning.get() >= 0)
if verbose:
print('%s is finished. %d tasks are running' %
- self.getName(), self.nrunning.get())
+ (self.getName(), self.nrunning.get()))
class ThreadTests(unittest.TestCase):
@@ -242,7 +243,10 @@
enum = threading.enumerate
old_interval = sys.getcheckinterval()
try:
- for i in range(1, 1000):
+ for i in range(1, 100):
+ # Try a couple times at each thread-switching interval
+ # to get more interleavings.
+ sys.setcheckinterval(i // 5)
t = threading.Thread(target=lambda: None)
t.start()
t.join()
More information about the Python-3000-checkins
mailing list