Code review comment for lp:~jcsackett/launchpad/add-enums-to-models

Revision history for this message
Robert Collins (lifeless) wrote :

On Sat, Aug 21, 2010 at 9:58 AM, j.c.sackett
<email address hidden> wrote:

> +
> +# Manually create the TestLoader list, because the UsageEnumsBaseTestCase
> +# shouldn't run.
> +test_list = [
> +    __name__ + ".TestDistributionUsageEnums",
> +    __name__ + ".TestProductUsageEnums",
> +    ]
> +
> +
> +def test_suite():
> +    return unittest.TestLoader().loadTestsFromNames(test_list)

There are a few slightly better ways of doing this.

Class UsageEnumsMixinIn
....stuff

class TestDistributionUsageEnums(TestCaseWithFactory, UsageEnumsMixin):
 ...

class TestProductUsageEnums(TestCaseWithFactory, UsageEnumsMixin):
...

is one.

Another is to use testscenarios, and your parameterisation would be
more explicit, but we don't use that in lp today AFAIK, so I won't
suggest adding it in (but you could get much the same helpers from
bzrlib.testing).

These are better because they don't have a class that looks-to-loaders
like a valid test case, but isn't.

-Rob

« Back to merge proposal