[Python-checkins] r51698 - python/branches/hoxworth-stdlib_logging-soc/new_soc_logging_test.py python/branches/hoxworth-stdlib_logging-soc/pep_update.txt python/branches/hoxworth-stdlib_logging-soc/test_gopherlib_logging.py python/branches/hoxworth-stdlib_logging-soc/test_httplib_logging.py python/branches/hoxworth-stdlib_logging-soc/test_ihooks_logging.py python/branches/hoxworth-stdlib_logging-soc/test_imaplib_logging.py python/branches/hoxworth-stdlib_logging-soc/test_mhlib_logging.py python/branches/hoxworth-stdlib_logging-soc/test_nntplib_logging.py python/branches/hoxworth-stdlib_logging-soc/test_pipes_logging.py python/branches/hoxworth-stdlib_logging-soc/test_stmpd_logging.py python/branches/hoxworth-stdlib_logging-soc/test_threading_logging.py python/branches/hoxworth-stdlib_logging-soc/test_timeit_logging.py

jackilyn.hoxworth python-checkins at python.org
Sun Sep 3 18:22:29 CEST 2006


Author: jackilyn.hoxworth
Date: Sun Sep  3 18:22:27 2006
New Revision: 51698

Added:
   python/branches/hoxworth-stdlib_logging-soc/test_gopherlib_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_httplib_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_ihooks_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_imaplib_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_mhlib_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_nntplib_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_pipes_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_threading_logging.py
   python/branches/hoxworth-stdlib_logging-soc/test_timeit_logging.py
Removed:
   python/branches/hoxworth-stdlib_logging-soc/new_soc_logging_test.py
   python/branches/hoxworth-stdlib_logging-soc/test_stmpd_logging.py
Modified:
   python/branches/hoxworth-stdlib_logging-soc/pep_update.txt
Log:
created tests for the logging

Deleted: /python/branches/hoxworth-stdlib_logging-soc/new_soc_logging_test.py
==============================================================================
--- /python/branches/hoxworth-stdlib_logging-soc/new_soc_logging_test.py	Sun Sep  3 18:22:27 2006
+++ (empty file)
@@ -1,42 +0,0 @@
-import httplib
-reload(httplib)
-import fakesocket
-import logging
-from cStringIO import StringIO
-
-origsocket=httplib.socket
-# monkeypatch -- replace httplib.socket with our own fake module
-httplib.socket=fakesocket
-
-# ... run the tests ...
-log=logging.getLogger("py.httplib")
-stringLog = StringIO()
-
-# define the handler and level
-handler = logging.StreamHandler(stringLog)
-log.setLevel(logging.INFO)
-
-# add the handler to the logger
-log.addHandler(handler)
-
-httplib._log.info("message 1") # 1st test
-
-myconn = httplib.HTTPConnection('www.google.com')
-myconn.set_debuglevel(43)
-if myconn.debuglevel > 0:
-	print "Debug level is > 0"
-
-#myconn.connect()
-httplib.HTTPConnection('MOCK')
-myconn.putrequest("GET", "/search?q=python")
-#myconn.getresponse()
-
-print stringLog.getvalue()  # For testing purposes
-
-if stringLog.getvalue() != "Error:  It worked":
-    print "it worked"
-else:
-    print "it didn't work"
-
-# restore it to working order, so other tests won't fail
-httplib.socket=origsocket
\ No newline at end of file

Modified: python/branches/hoxworth-stdlib_logging-soc/pep_update.txt
==============================================================================
--- python/branches/hoxworth-stdlib_logging-soc/pep_update.txt	(original)
+++ python/branches/hoxworth-stdlib_logging-soc/pep_update.txt	Sun Sep  3 18:22:27 2006
@@ -5,17 +5,17 @@
 BaseHTTPServer.py - done but no test case created
 SocketServer.py - done but no test case created
 asyncore.py - done
-gopherlib.py - done but no test case created
-httplib - done with a test case almost completed
-ihooks.py - done but no test case created
-imaplib.py - done but no test case created
-mhlib.py - done but no test case created
-nntplib.py - done but no test case created
-pipes.py - done but no test case created
-pkgutil.py  - done but no test case created
+gopherlib.py - done
+httplib - done
+ihooks.py - done
+imaplib.py - done
+mhlib.py - done
+nntplib.py - done
+pipes.py - done
+pkgutil.py  - done
 robotparser.py - done
 shlex.py - done
 smtpd.py - done
-threading.py - done but no test case created
-timeit.py - done but no test case created
+threading.py - done and test case really close to completion, small problem
+timeit.py - done
 trace.py - done but no test case created
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_gopherlib_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_gopherlib_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import gopherlib
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.gopherlib")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+gopherlib._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_httplib_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_httplib_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,42 @@
+import httplib
+reload(httplib)
+import fakesocket
+import logging
+from cStringIO import StringIO
+
+origsocket=httplib.socket
+# monkeypatch -- replace httplib.socket with our own fake module
+httplib.socket=fakesocket
+
+# ... run the tests ...
+log=logging.getLogger("py.httplib")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+httplib._log.info("message 1") # 1st test
+
+myconn = httplib.HTTPConnection('www.google.com')
+myconn.set_debuglevel(43)
+if myconn.debuglevel > 0:
+	print "Debug level is > 0"
+
+#myconn.connect()
+httplib.HTTPConnection('MOCK')
+myconn.putrequest("GET", "/search?q=python")
+#myconn.getresponse()
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
+
+# restore it to working order, so other tests won't fail
+httplib.socket=origsocket
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_ihooks_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_ihooks_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import shlex
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.shlex")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+shlex._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_imaplib_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_imaplib_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import imaplib
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.imaplib")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+imaplib._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_mhlib_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_mhlib_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import mhlib
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.mhlib")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+mhlib._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_nntplib_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_nntplib_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import nntplib
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.nntplib")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+nntplib._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_pipes_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_pipes_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import pipes
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.pipes")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+pipes._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Deleted: /python/branches/hoxworth-stdlib_logging-soc/test_stmpd_logging.py
==============================================================================
--- /python/branches/hoxworth-stdlib_logging-soc/test_stmpd_logging.py	Sun Sep  3 18:22:27 2006
+++ (empty file)
@@ -1,23 +0,0 @@
-import smtpd
-import logging
-from cStringIO import StringIO
-
-# ... run the tests ...
-log=logging.getLogger("py.smtpd")
-stringLog = StringIO()
-
-# define the handler and level
-handler = logging.StreamHandler(stringLog)
-log.setLevel(logging.INFO)
-
-# add the handler to the logger
-log.addHandler(handler)
-
-smtpd._log.info("message 1") 
-
-print stringLog.getvalue()  # For testing purposes
-
-if stringLog.getvalue() != "Error:  It worked":
-    print "it worked"
-else:
-    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_threading_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_threading_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import threading
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.threading") # says there isn't a _log attribute ???
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+threading._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file

Added: python/branches/hoxworth-stdlib_logging-soc/test_timeit_logging.py
==============================================================================
--- (empty file)
+++ python/branches/hoxworth-stdlib_logging-soc/test_timeit_logging.py	Sun Sep  3 18:22:27 2006
@@ -0,0 +1,23 @@
+import timeit
+import logging
+from cStringIO import StringIO
+
+# ... run the tests ...
+log=logging.getLogger("py.timeit")
+stringLog = StringIO()
+
+# define the handler and level
+handler = logging.StreamHandler(stringLog)
+log.setLevel(logging.INFO)
+
+# add the handler to the logger
+log.addHandler(handler)
+
+timeit._log.info("message 1")
+
+print stringLog.getvalue()  # For testing purposes
+
+if stringLog.getvalue() != "Error:  It worked":
+    print "it worked"
+else:
+    print "it didn't work"
\ No newline at end of file


More information about the Python-checkins mailing list