[Checkins] SVN: zc.thread/trunk/ Thread names now include a function's module name.
jim
cvs-admin at zope.org
Tue Jan 1 20:41:07 UTC 2013
Log message for revision 128983:
Thread names now include a function's module name.
Changed:
U zc.thread/trunk/README.txt
U zc.thread/trunk/src/zc/thread/__init__.py
U zc.thread/trunk/src/zc/thread/tests.py
-=-
Modified: zc.thread/trunk/README.txt
===================================================================
--- zc.thread/trunk/README.txt 2013-01-01 20:34:03 UTC (rev 128982)
+++ zc.thread/trunk/README.txt 2013-01-01 20:41:06 UTC (rev 128983)
@@ -48,6 +48,11 @@
Changes
*******
+0.1.1 (2013-01-01)
+==================
+
+- Thread names now include a function's module name.
+
0.1.0 (2011-11-27)
==================
Modified: zc.thread/trunk/src/zc/thread/__init__.py
===================================================================
--- zc.thread/trunk/src/zc/thread/__init__.py 2013-01-01 20:34:03 UTC (rev 128982)
+++ zc.thread/trunk/src/zc/thread/__init__.py 2013-01-01 20:41:06 UTC (rev 128983)
@@ -25,10 +25,11 @@
except Exception, v:
thread.exception = v
- thread = class_(
- target=run, name=getattr(func, '__name__', None),
- args=args, kwargs=kwargs)
+ name = "%s.%s" % (getattr(func, '__module__', None),
+ getattr(func, '__name__', None))
+ thread = class_(target=run, name=name, args=args, kwargs=kwargs)
+
if hasattr(thread, 'setDaemon'):
thread.setDaemon(daemon)
else:
Modified: zc.thread/trunk/src/zc/thread/tests.py
===================================================================
--- zc.thread/trunk/src/zc/thread/tests.py 2013-01-01 20:34:03 UTC (rev 128982)
+++ zc.thread/trunk/src/zc/thread/tests.py 2013-01-01 20:41:06 UTC (rev 128983)
@@ -28,7 +28,8 @@
Thread.call_args[1].pop('target')()
self.assert_(foo.value == 42 and foo.exception is None)
- Thread.assert_called_with(name='foo', args=(), kwargs={})
+ Thread.assert_called_with(name='zc.thread.tests.foo',
+ args=(), kwargs={})
foo.setDaemon.assert_called_with(True)
foo.start.assert_called_with()
@@ -39,7 +40,7 @@
t = zc.thread.Thread(foo2)
Thread.call_args[1].pop('target')()
- Thread.assert_called_with(name='foo2', args=(), kwargs=dict())
+ Thread.assert_called_with(name='zc.thread.tests.foo2', args=(), kwargs=dict())
t.setDaemon.assert_called_with(True)
t.start.assert_called_with()
self.assert_(t.value is None)
@@ -48,7 +49,8 @@
t = zc.thread.Thread(foo2, args=(1, 2))
Thread.call_args[1].pop('target')(1, 2)
- Thread.assert_called_with(name='foo2', args=(1, 2), kwargs=dict())
+ Thread.assert_called_with(name='zc.thread.tests.foo2',
+ args=(1, 2), kwargs=dict())
t.setDaemon.assert_called_with(True)
t.start.assert_called_with()
self.assert_(t.value is None)
@@ -63,7 +65,8 @@
Thread.call_args[1].pop('target')(1, 2, **dict(a=1))
self.assert_(foo.value == ((1, 2), dict(a=1)))
- Thread.assert_called_with(name='foo', args=(1, 2), kwargs=dict(a=1))
+ Thread.assert_called_with(name='zc.thread.tests.foo',
+ args=(1, 2), kwargs=dict(a=1))
foo.setDaemon.assert_called_with(False)
self.assert_(not foo.start.called)
@@ -82,7 +85,8 @@
def foo():
print 'foo called'
Process.call_args[1].pop('target')()
- Process.assert_called_with(name='foo', args=(), kwargs={})
+ Process.assert_called_with(name='zc.thread.tests.foo',
+ args=(), kwargs={})
self.assert_(foo.daamon)
foo.start.assert_called_with()
Process.reset_mock()
@@ -93,7 +97,7 @@
Process.call_args[1].pop('target')()
self.assertEqual(Process.return_value.value, 42)
Process.assert_called_with(
- name='foo2', args=(), kwargs={})
+ name='zc.thread.tests.foo2', args=(), kwargs={})
self.assert_(t.daamon)
t.start.assert_called_with()
Process.reset_mock()
@@ -110,7 +114,7 @@
print 'foo3 called'
Process.call_args[1].pop('target')()
Process.assert_called_with(
- name='foo3', args=(42,), kwargs=dict(a=1))
+ name='zc.thread.tests.foo3', args=(42,), kwargs=dict(a=1))
self.assert_(not foo3.daemon)
self.assert_(not foo3.start.called)
More information about the checkins
mailing list