[Checkins] SVN: zodbupdate/branches/sylvain-persistent-load/ Fix tearDown, remove unneeded test.
Sylvain Viollon
sylvain at infrae.com
Tue Feb 2 05:40:58 EST 2010
Log message for revision 108707:
Fix tearDown, remove unneeded test.
Changed:
U zodbupdate/branches/sylvain-persistent-load/README.txt
U zodbupdate/branches/sylvain-persistent-load/src/zodbupdate/tests.py
-=-
Modified: zodbupdate/branches/sylvain-persistent-load/README.txt
===================================================================
--- zodbupdate/branches/sylvain-persistent-load/README.txt 2010-02-02 08:20:11 UTC (rev 108706)
+++ zodbupdate/branches/sylvain-persistent-load/README.txt 2010-02-02 10:40:58 UTC (rev 108707)
@@ -9,9 +9,10 @@
If a class is being moved or renamed, you need to update all references from
your database to the new name before finally deleting the old code.
-This tool looks through all current objects of your database, identifies
-moved/renamed classes and `touches` objects accordingly. It creates a single
-transaction that contains the update of your database.
+This tool looks through all current objects of your database,
+identifies moved/renamed classes and `touches` objects accordingly. It
+creates transactions that contains the update of your database (one
+transaction every 100000 records).
Having run this tool, you are then free to delete the old code.
Modified: zodbupdate/branches/sylvain-persistent-load/src/zodbupdate/tests.py
===================================================================
--- zodbupdate/branches/sylvain-persistent-load/src/zodbupdate/tests.py 2010-02-02 08:20:11 UTC (rev 108706)
+++ zodbupdate/branches/sylvain-persistent-load/src/zodbupdate/tests.py 2010-02-02 10:40:58 UTC (rev 108707)
@@ -27,18 +27,23 @@
import zodbupdate.update
-class IgnoringFilter(object):
- # Do not spit out any logging during testing.
+class LogFilter(object):
+
+ def __init__(self, msg_lst):
+ self.msg_lst = msg_lst
+
+ # Do not spit out any logging, but record them
def filter(self, record):
+ self.msg_lst.append(record.msg)
return False
-ignore = IgnoringFilter()
-
class ZODBUpdateTests(unittest.TestCase):
def setUp(self):
- zodbupdate.update.logger.addFilter(ignore)
+ self.log_messages = []
+ self.log_filter = LogFilter(self.log_messages)
+ zodbupdate.update.logger.addFilter(self.log_filter)
sys.modules['module1'] = types.ModuleType('module1')
sys.modules['module2'] = types.ModuleType('module2')
@@ -73,8 +78,9 @@
return updater
def tearDown(self):
- zodbupdate.update.logger.removeFilter(ignore)
+ zodbupdate.update.logger.removeFilter(self.log_filter)
del sys.modules['module1']
+ del sys.modules['module2']
self.db.close()
os.unlink(self.dbfile)
@@ -82,15 +88,6 @@
os.unlink(self.dbfile + '.tmp')
os.unlink(self.dbfile + '.lock')
- def test_factory_missing(self):
- # Create a ZODB with an object referencing a factory, then
- # remove the factory and update the ZODB.
- self.root['test'] = sys.modules['module1'].Factory()
- transaction.commit()
- del sys.modules['module1'].Factory
-
- self.update()
-
def test_factory_ignore_missing(self):
# Create a ZODB with an object referencing a factory, then
# remove the factory and update the ZODB.
@@ -104,6 +101,9 @@
self.storage.load(self.root['test']._p_oid, '')[0])
self.assert_(isinstance(self.root['test'],
ZODB.broken.PersistentBroken))
+ self.failUnless(len(self.log_messages))
+ self.assertEquals('Warning: Missing factory for module1 Factory',
+ self.log_messages[0])
renames = updater.processor.get_found_implicit_rules()
self.assertEquals({}, renames)
More information about the checkins
mailing list