Unittest

Terry Reedy tjreedy at udel.edu
Tue Jul 26 01:57:41 EDT 2016


On 7/25/2016 12:45 PM, Joaquin Alzola wrote:
> Hi Guys
>
> I have a question related to unittest.
>
> I suppose a SW that is going to live will not have any trace of
> unittest module along their code.

In order to test idlelib, I had to a _utest=False (unittest = False) 
parameter to some functions.  They are there when you run IDLE.

I like to put

if __name__ == '__main__': <run this file's unittest test> at the bottom 
of non-script files.  Some people don't like this, but it makes running 
the tests trivial while editing a file -- whether to make a test pass or 
to avoid regressions when making 'neutral' changes.

> So is it the way to do it to put all unittest in a preproduction
> environment and then remove all lines relate to unittest once the SW
> is release into production?

How would you know that you do not introduce bugs when you change code 
after testing?

When you install Python on Windows, installing the test/ directory is a 
user option.

-- 
Terry Jan Reedy




More information about the Python-list mailing list