[Checkins] SVN: ZConfig/branches/LP-481512-reopen-logs/ZConfig/components/logger/tests/test_logger.py Only applies to FileHandler.
Gary Poster
gary.poster at canonical.com
Thu Jul 28 08:27:23 EDT 2011
Log message for revision 122391:
Only applies to FileHandler.
Changed:
U ZConfig/branches/LP-481512-reopen-logs/ZConfig/components/logger/tests/test_logger.py
-=-
Modified: ZConfig/branches/LP-481512-reopen-logs/ZConfig/components/logger/tests/test_logger.py
===================================================================
--- ZConfig/branches/LP-481512-reopen-logs/ZConfig/components/logger/tests/test_logger.py 2011-07-28 12:27:20 UTC (rev 122390)
+++ ZConfig/branches/LP-481512-reopen-logs/ZConfig/components/logger/tests/test_logger.py 2011-07-28 12:27:23 UTC (rev 122391)
@@ -458,28 +458,6 @@
self.assert_("message 4" in text2)
self.assert_("message 5" in text3)
- def test_filehandler_reopen_thread_safety(self):
- # The reopen method needs to do locking to avoid a race condition
- # with emit calls. For simplicity we replace the "acquire" and
- # "release" calls with dummy method that counts its calls.
- class FakeMethod(object):
- def __init__(self):
- self.call_count = 0
-
- def __call__(self):
- self.call_count += 1
-
- fn = self.mktemp()
- h = self.handler_factory(fn)
- h.acquire = FakeMethod()
- h.release = FakeMethod()
-
- h.reopen()
- h.close()
-
- self.assertEqual(2, h.acquire.call_count)
- self.assertEqual(2, h.release.call_count)
-
class TestReopeningLogfiles(TestReopeningLogfilesBase):
handler_factory = loghandler.FileHandler
@@ -559,7 +537,29 @@
logger.removeHandler(handler)
handler.close()
+ def test_filehandler_reopen_thread_safety(self):
+ # The reopen method needs to do locking to avoid a race condition
+ # with emit calls. For simplicity we replace the "acquire" and
+ # "release" calls with dummy method that counts its calls.
+ class FakeMethod(object):
+ def __init__(self):
+ self.call_count = 0
+ def __call__(self):
+ self.call_count += 1
+
+ fn = self.mktemp()
+ h = self.handler_factory(fn)
+ h.acquire = FakeMethod()
+ h.release = FakeMethod()
+
+ h.reopen()
+ h.close()
+
+ self.assertEqual(2, h.acquire.call_count)
+ self.assertEqual(2, h.release.call_count)
+
+
class TestReopeningRotatingLogfiles(TestReopeningLogfilesBase):
_sampleconfig_template = """
More information about the checkins
mailing list