[Pyunit-interest] Re: testRunner argument of unittest.main()
Brought to you by:
purcell
From: Matthew F. B. <mf...@lo...> - 2003-05-14 02:22:44
|
>> Not the most "clean" solution, but it would probably work. By that I >> mean that generally (for me, anyway) the desire is to parse all the >> command-line arguments *once* in a program. The unittest.main() >> routine is already doing that work, and the software engineer in me >> would hate to see that logic replicated elsewhere in the same program. robin and jim said: > You might consider using the getopt module to parse the return value > from sys.argv. True, but my point was that unittest.main() is doing that already, and I wouldn't want to replicate that logic in two or more places in the same program because it then becomes a maintenance issue for me. Ideally I'd like to pass unittest.main() my custom TestRunner class (called myTestRunner) and have unittest.main() create an instance of myTestRunner and supply it the correct verbosity setting with no sys.argv parsing on my part. Currently my solution is to subclass unittest.TestProgram and alter its behavior according to my original suggestion. It seems to work fine. I guess at this point I'm wondering if my original suggestion would be a useful enhancement to the "official" unittest module. Matthew Barnes ma...@ba... |