[Checkins] SVN: zc.resumelb/trunk/src/zc/resumelb/ Fixed: Worker resume data wasn't initialized correctly when no
jim
cvs-admin at zope.org
Mon May 7 14:39:29 UTC 2012
Log message for revision 125682:
Fixed: Worker resume data wasn't initialized correctly when no
parameters are passed to the constructor and when reading a resume
file, causing resmes not not to update.
Changed:
U zc.resumelb/trunk/src/zc/resumelb/README.txt
U zc.resumelb/trunk/src/zc/resumelb/tests.py
U zc.resumelb/trunk/src/zc/resumelb/worker.py
-=-
Modified: zc.resumelb/trunk/src/zc/resumelb/README.txt
===================================================================
--- zc.resumelb/trunk/src/zc/resumelb/README.txt 2012-05-07 14:38:23 UTC (rev 125681)
+++ zc.resumelb/trunk/src/zc/resumelb/README.txt 2012-05-07 14:39:25 UTC (rev 125682)
@@ -242,6 +242,13 @@
Change History
==============
+0.5.1 (2012-05-07)
+------------------
+
+- Fixed: Worker resume data wasn't initialized correctly when no
+ parameters are passed to the constructor and when reading a resume
+ file, causing resmes not not to update.
+
0.5.0 (2012-05-03)
------------------
Modified: zc.resumelb/trunk/src/zc/resumelb/tests.py
===================================================================
--- zc.resumelb/trunk/src/zc/resumelb/tests.py 2012-05-07 14:38:23 UTC (rev 125681)
+++ zc.resumelb/trunk/src/zc/resumelb/tests.py 2012-05-07 14:39:25 UTC (rev 125682)
@@ -18,8 +18,10 @@
import manuel.capture
import manuel.doctest
import manuel.testing
+import marshal
import mock
import os
+import pprint
import re
import time
import unittest
@@ -84,6 +86,23 @@
#
###############################################################################
+def test_loading_recipes_with_no_history_argument():
+ """A bug as introduced that caused resumes to be loaded
+ incorrectly when no history was given to the constructor. It
+ cause invalif perf_data to be initialized.
+
+ >>> with open('resume.mar', 'w') as f:
+ ... marshal.dump(dict(a=1.0, b=2.0), f)
+
+ >>> worker = zc.resumelb.worker.Worker(
+ ... zc.resumelb.tests.app(), ('127.0.0.1', 0),
+ ... resume_file='resume.mar')
+
+ >>> pprint.pprint(worker.perf_data)
+ {'a': (0, 1.0, 9999), 'b': (0, 0.5, 9999)}
+ """
+
+
def test_classifier(env):
return "yup, it's a test"
@@ -137,5 +156,7 @@
) + manuel.capture.Manuel(),
'zk.test',
setUp=zkSetUp, tearDown=zkTearDown),
+ doctest.DocTestSuite(
+ setUp=setUp, tearDown=zope.testing.setupstack.tearDown),
))
Modified: zc.resumelb/trunk/src/zc/resumelb/worker.py
===================================================================
--- zc.resumelb/trunk/src/zc/resumelb/worker.py 2012-05-07 14:38:23 UTC (rev 125681)
+++ zc.resumelb/trunk/src/zc/resumelb/worker.py 2012-05-07 14:39:25 UTC (rev 125682)
@@ -49,7 +49,7 @@
else:
for rclass, rpm in self.resume.iteritems():
if rpm > 0:
- self.perf_data[rclass] = 0, 1.0/rpm, history
+ self.perf_data[rclass] = 0, 1.0/rpm, self.history
self.connections = set()
More information about the checkins
mailing list