unittest

Scott David Daniels Scott.Daniels at Acm.Org
Sat Aug 15 19:11:29 CEST 2009


Mag Gam wrote:
> I am writing an application which has many command line arguments.
> For example: foo.py -args "bar bee"
> 
> I would like to create a test suit using unittest so when I add
> features to "foo.py" I don't want to break other things. I just heard
> about unittest and would love to use it for this type of thing.
> 
> so my question is, when I do these tests do I have to code them into
> foo.py? I prefer having a footest.py which will run the regression
> tests. Any thoughts about this?
> 
> TIA
I avoid putting the tests in foo.py, simply because the bulk of my
tests would make the code harder to read.  So, no, unittest does not
require that you code things into foo.py.  You will find that you
may bend your coding style within foo.py in order to make it more
testable, but (if you do it right) that should also make the code
clearer.

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list