[Python-Dev] Unit Test Guide

Virgil Dupras hsoft at hardcoded.net
Thu Feb 21 13:22:20 CET 2008

On 2/21/08, Virgil Dupras <hsoft at hardcoded.net> wrote:
> Hi devs,
>  Being a python dev newbie, I look in http://www.python.org/dev/ for
>  some guide to write unit tests in python and I can't find any.
>  Specifically, I'd like to know about files managements in tests. Is
>  every test expected to clean after itself, or is there an automatic
>  cleanup mechanism in place? Even more specifically, I'd like to create
>  a test for the proposed patch in http://bugs.python.org/issue2127 so I
>  need to create a subdir with non-ascii character in it, then connect
>  to a db in it. So, do I need to do the cleanup in the test? Is there a
>  special path I can write to that will automatically be cleaned up? If
>  not, wouldn't it be a good idea to have one?
>  I guess I could find the answer in regrtest.py, but frankly, this unit
>  is a little bit overwhelming.
>  If there is no guide, am I the only one to think it would be a good
>  idea to have one (Yeah, I could volunteer to write it)?
>  Virgil

Oops, nevermind I ended up finding it at
http://docs.python.org/lib/module-test.html and
http://docs.python.org/lib/module-test.testsupport.html. I didn't
expect to find it in the Python documentation itself. Sorry. Might I
suggest adding a link to it in http://www.python.org/dev/?


More information about the Python-Dev mailing list