unittest -- simple question
Ian Bicking
ianb at colorstudy.com
Sun Nov 2 03:11:11 EST 2003
On Nov 1, 2003, at 10:30 PM, Brian wrote:
> I am writing my test modules that are separate from the modules they
> test. The test modules can be invoked with if __name__ == "__main__"
> when
> run from a command line. Right now, if __name__ == "__main__", the test
> module executes runTests(), which defines a suite of tests. From the
> module being tested, I am calling into the test module -- to the
> function
> runTests(), if __name__ == "__main__".
>
> Is this how people make the tests executable from the module be tested?
If I understand what you're saying, you have something like:
def runTests():
....
if __name__ == '__main__':
runTests()
? If so, then yes, this is the conventional and approved way to make
any module into a simple program, tests included.
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the Python-list
mailing list