[Checkins] SVN: Sandbox/J1m/s3uploadqueue/src/zc/s3uploadqueue/README.txt code coverage.

satchit@zope.com cvs-admin at zope.org
Fri Jun 15 15:39:45 UTC 2012


Log message for revision 126865:
  code coverage.
  
  

Changed:
  U   Sandbox/J1m/s3uploadqueue/src/zc/s3uploadqueue/README.txt

-=-
Modified: Sandbox/J1m/s3uploadqueue/src/zc/s3uploadqueue/README.txt
===================================================================
--- Sandbox/J1m/s3uploadqueue/src/zc/s3uploadqueue/README.txt	2012-06-15 15:25:11 UTC (rev 126864)
+++ Sandbox/J1m/s3uploadqueue/src/zc/s3uploadqueue/README.txt	2012-06-15 15:39:41 UTC (rev 126865)
@@ -108,6 +108,16 @@
 
     >>> write('/'.join(['test', name.strip()]), '')
 
+    >>> import logging
+    >>> import zope.testing.loggingsupport
+
+    >>> handler = zope.testing.loggingsupport.InstalledHandler(
+    ...     "zc.s3uploadqueue", level=logging.INFO)
+
+    >>> def show_log():
+    ...     print handler
+    ...     handler.clear()
+
     Start the processor:
 
     >>> exec src
@@ -132,3 +142,26 @@
     [call(<MagicMock name='S3Connection().get_bucket()' id='...'>),
      call(<MagicMock name='S3Connection().get_bucket()' id='...'>),
      call().set_contents_from_filename('test/2012-06-14%2F01.txt')]
+
+    >>> show_log()
+    zc.s3uploadqueue INFO
+      Transferred '2012-06-14%2F01.txt'
+
+If there's an exception, that'll be logged as well. To simulate an exception,
+we'll monkey-patch the "urllib.unquote" method to raise an exception.
+
+    >>> import urllib
+    >>> orig_unquote = urllib.unquote
+    >>> def fake_unquote(s):
+    ...     1/0
+    >>> urllib.unquote = fake_unquote
+    >>> write('/'.join(['test', name.strip()]), '')
+    >>> exec src
+
+    >>> show_log()
+    zc.s3uploadqueue ERROR
+      processing '2012-06-14%2F01.txt'
+
+    >>> urllib.unquote = orig_unquote
+    >>> handler.uninstall()
+



More information about the checkins mailing list