testtools-dev team mailing list archive
-
testtools-dev team
-
Mailing list archive
-
Message #01147
Re: [Merge] lp:~lifeless/testtools/bug-1091512 into lp:testtools
On 18 December 2012 09:14, Robert Collins <robertc@xxxxxxxxxxxxxxxxx> wrote:
> Robert Collins has proposed merging lp:~lifeless/testtools/bug-1091512 into lp:testtools.
>
> Requested reviews:
> testtools committers (testtools-committers)
> Related bugs:
> Bug #1091512 in testtools: "load-list order is arbitrary"
> https://bugs.launchpad.net/testtools/+bug/1091512
>
> For more details, see:
> https://code.launchpad.net/~lifeless/testtools/bug-1091512/+merge/140369
>
> This works around an annoying defect in the python discover implementation, giving more reliable test ordering for folk using discovery.
>
> I took care to make it possible for things like testresources.OptimisingTestSuite to stay intact, though we still have an issue with --load-list and such suites. (bug 827175)
Thanks. This is good to land w/ some optional tweaks below.
> +def _flatten_tests(suite_or_case, unpack_outer=False):
> + try:
> + tests = iter(suite_or_case)
> + except TypeError:
> + # Not iterable, assume its a test case.
"it's", fwiw.
> + return [(suite_or_case.id(), suite_or_case)]
> + if (type(suite_or_case) in (unittest.TestSuite,) or
> + unpack_outer):
A couple of things here:
- putting unpack_outer first in the 'or' is probably a little faster
& just as readable
- why `type(x) in (T,)`? why not, say, `type(x) == T`?
cheers,
jml
--
https://code.launchpad.net/~lifeless/testtools/bug-1091512/+merge/140369
Your team testtools developers is subscribed to branch lp:testtools.
References