[Checkins] SVN: Sandbox/ctheune/zodbupgrade/src/zodbupgrade/ Silence logging output during test runs.
Christian Theune
ct at gocept.com
Wed Jun 3 02:43:14 EDT 2009
Log message for revision 100606:
Silence logging output during test runs.
Changed:
U Sandbox/ctheune/zodbupgrade/src/zodbupgrade/analyze.py
U Sandbox/ctheune/zodbupgrade/src/zodbupgrade/tests.py
-=-
Modified: Sandbox/ctheune/zodbupgrade/src/zodbupgrade/analyze.py
===================================================================
--- Sandbox/ctheune/zodbupgrade/src/zodbupgrade/analyze.py 2009-06-03 06:32:30 UTC (rev 100605)
+++ Sandbox/ctheune/zodbupgrade/src/zodbupgrade/analyze.py 2009-06-03 06:43:14 UTC (rev 100606)
@@ -54,14 +54,14 @@
missing_factories.add('%s.%s' % (module_name, symbol))
else:
if not hasattr(factory, '__name__'):
- logging.warn(
+ logger.warn(
"factory %r does not have __name__, can't check canonical location" % factory)
continue
if not hasattr(factory, '__module__'):
# TODO: This case isn't covered with a test. I just
# couldn't provoke a factory to not have a __module__ but
# users reported this issue to me.
- logging.warn(
+ logger.warn(
"factory %r does not have __module__, can't check canonical location" % factory)
continue
if ((factory.__module__, factory.__name__) !=
@@ -117,12 +117,11 @@
if missing_classes:
raise ValueError(missing_classes)
- print "Rewriting database with mapping:"
+ logger.info("Rewriting database with mapping:")
for (old_mod, old_name), (new_mod, new_name) in rewrites_found.items():
- print "%s.%s -> %s.%s" % (old_mod, old_name, new_mod, new_name)
+ logger.info("%s.%s -> %s.%s" % (old_mod, old_name, new_mod, new_name))
+ logger.info("%i objects need rewriting" % len(oids))
- print "%i objects need rewriting" % len(oids)
-
db = DB(storage)
connection = db.open()
for oid in oids:
Modified: Sandbox/ctheune/zodbupgrade/src/zodbupgrade/tests.py
===================================================================
--- Sandbox/ctheune/zodbupgrade/src/zodbupgrade/tests.py 2009-06-03 06:32:30 UTC (rev 100605)
+++ Sandbox/ctheune/zodbupgrade/src/zodbupgrade/tests.py 2009-06-03 06:43:14 UTC (rev 100606)
@@ -21,13 +21,22 @@
import unittest
import transaction
import zodbupgrade.analyze
+import logging
+class IgnoringFilter(object):
+ def filter(self, record):
+ return False
+ignore = IgnoringFilter()
+
+
class ZODBUpgradeTests(unittest.TestCase):
def setUp(self):
+ zodbupgrade.analyze.logger.addFilter(ignore)
+
sys.modules['module1'] = types.ModuleType('module1')
class Factory(object):
pass
@@ -39,6 +48,7 @@
self.reopen_db()
def tearDown(self):
+ zodbupgrade.analyze.logger.removeFilter(ignore)
del sys.modules['module1']
self.db.close()
More information about the Checkins
mailing list