Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111879

Re: Unittest

From Terry Reedy <tjreedy@udel.edu>
Newsgroups comp.lang.python
Subject Re: Unittest
Date 2016-07-26 01:57 -0400
Message-ID <mailman.122.1469512678.22221.python-list@python.org> (permalink)
References <DB5PR07MB0806EBAFDC5A916BA2A5882AF00D0@DB5PR07MB0806.eurprd07.prod.outlook.com> <nn6u4n$r49$1@ger.gmane.org>

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Unittest Terry Reedy <tjreedy@udel.edu> - 2016-07-26 01:57 -0400

csiph-web