C
chrisber
using the unittest module in Python 2.3.5, I've written some test code
that ends up with
if __name__ == "__main__":
unittest.main()
Since I want to run this code in various environments, I'd initially
added some commandline options, e.g. to specify a configuration file
like so
test.py -c devtest.conf
or
test.py -c localtest.conf
etc.
However, unittest also looks for options on the commandline, and it
was complaining about unrecognized options and quitting.
I've poked around to see if I could delete the options my earlier code
consumed from the commandline buffer, before invoking unittest, but
that seems klugy. Instead, I hardwired in a testing config file name,
that always has to be local. That works pretty well, but it leaves me
wonderfing whether there would have been another clean way to allow
both my test code and unittest to have options without interfering
with one another.
that ends up with
if __name__ == "__main__":
unittest.main()
Since I want to run this code in various environments, I'd initially
added some commandline options, e.g. to specify a configuration file
like so
test.py -c devtest.conf
or
test.py -c localtest.conf
etc.
However, unittest also looks for options on the commandline, and it
was complaining about unrecognized options and quitting.
I've poked around to see if I could delete the options my earlier code
consumed from the commandline buffer, before invoking unittest, but
that seems klugy. Instead, I hardwired in a testing config file name,
that always has to be local. That works pretty well, but it leaves me
wonderfing whether there would have been another clean way to allow
both my test code and unittest to have options without interfering
with one another.