[Python-checkins] r51629 - python/branches/hoxworth-stdlib_logging-soc/test_smtpd_logging.py

Jim Jewett jimjjewett at gmail.com
Mon Aug 28 17:39:44 CEST 2006


This looks more like the older "someone has to be watching to tell if
it failed" format.

Much better than nothing, but not the goal.  If you're checking in
what you already have, great; if you're writing new, try to make it
auto-checkable (though this is still much better than nothing.)

-jJ

On 8/27/06, jackilyn.hoxworth <python-checkins at python.org> wrote:
> Author: jackilyn.hoxworth
> Date: Mon Aug 28 02:22:37 2006
> New Revision: 51629
>
> Added:
>    python/branches/hoxworth-stdlib_logging-soc/test_smtpd_logging.py
> Log:
>
>
> Added: python/branches/hoxworth-stdlib_logging-soc/test_smtpd_logging.py
> ==============================================================================
> --- (empty file)
> +++ python/branches/hoxworth-stdlib_logging-soc/test_smtpd_logging.py   Mon Aug 28 02:22:37 2006
> @@ -0,0 +1,23 @@
> +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
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


More information about the Python-checkins mailing list