[TIP] Meta-test methods...
Robert Collins
robertc at robertcollins.net
Fri Apr 24 16:37:42 PDT 2009
On Fri, 2009-04-24 at 09:16 -0400, Douglas Philips wrote:
> On or about 2009 Apr 24, at 1:25 AM, Robert Collins indited:
> > At least in unittest, you can do this just by generating whatever
> > tests
> > you want in TestSuite.__iter__.
> >
> > countTestCases clearly can't do a lot there, but that is the only
> > method
> > in the protocol that conflicts with generation.
>
> True, but the point here is to create the tests in the test code
> itself. :)
class GeneratingSomeTests(TestSuite):
def __iter__(self):
for _ in range(4000):
def test():
assert 1 == 2
yield FunctionTestCase(test)
AIUI this is the sort of thing you mean? I realise this is spelt
slightly more verbosely than nose does - but it [clearly] is possible to
take an iterable and wrap it programatically. Personally I find tests
generated like this (nose style or as above) somewhat awkward. I'm
curious what sort of testing problems you (and Titus and ...) find
generated tests attractive for.
-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090425/c6e45dea/attachment.pgp
More information about the testing-in-python
mailing list