[Twisted-Python] Trial Loader: nested test suites
Markus Schiltknecht
markus at bluegap.ch
Tue Nov 21 17:49:19 EST 2006
Hi,
Jonathan Lange wrote:
> You can already nest TestSuites. That's half the point of having them.
> <snipped the fine code example>
> Perhaps you mean something else.
Yes, I want to setUp and tearDown processes and/or network connections
in nested testsuites. What's the point in nesting TestSuites if they
don't do anything?
> Before anything gets in to Twisted, it has to have a ticket on the
> issue tracker, "decent" code and unit tests. See
> http://twistedmatrix.com/trac/wiki/ReviewProcess and
> http://twistedmatrix.com/projects/core/documentation/howto/policy/coding-standard.html
Thanks for the hints. I mainly wanted to make sure it's worth following
that path further, which I'm still very uncertain.
> Looking at your patch, you seem to be doing two things: adding setUp
> and tearDown all over the place;
Wait, that's a little exaggerated. Two places: before and after running
a testsuite and when loading it. You can't possibly insert it at less
places if you want that functionality.
> and fiddling with the loadPackage()
> function. A casual scan doesn't tell me if those two changes depend on
> each other. Smaller patches are more likely to be accepted.
The fiddling in loadPackage makes sure it checks every module for setUp
and tearDown methods by really recursively call loadByName() for every
sub-module (even if it does not contain test cases).
> More importantly than that, I'm still not clear on what problem you
> are trying to solve.
Please have a look at the thread in [1], that message explains best,
what I want to achieve.
> Also I should note that I am hesitant to allow Trial's suites to run
> any user code apart from unit tests. A lot of bad code has been
> written that way.
That's what I fear will break the neck of integrating this. I know I'm
not writing standard unit tests, but something similar.
Now, I know unit tests should be simple and testing only one unit of
code. But what if you *want* to test your complete program, simulate
network outages and the like. What's so entirely different to unit
testing, besides needing little improvements?
Regards
Markus
[1]:
http://twistedmatrix.com/pipermail/twisted-python/2006-November/014370.html
More information about the Twisted-Python
mailing list