[TIP] hackish generative tests (was: Re: Generating tests, II (was: Re: Meta-test methods...))

Douglas Philips dgou at mac.com
Tue Apr 28 06:26:12 PDT 2009


On or about 2009 Apr 28, at 7:17 AM, holger krekel indited:
Testing is an application of meta-programming and meta-programming
> naturally involves reflection techniques.

It is not reflection, per se, that I am objecting to, as we agree below:


> ... this is a good point.  Dual-using the "test_*" naming
> convention for test generators i now consider a bad idea that
> lead to implementation complications both for py.test and nose.
> In that sense i agree to your "cracking open a method" critcism.

Yes. I think it was a cool idea that made a great proof of concept  
(creating test methods dynamically).


> However, I think that instrumenting a test run to invoke tests
> with multiple different parameters or in multiple environments
> is useful and worthwhile.

Agreed. It provides nice isolation, test-selection/filtering, and  
reporting benefits.


> So i'd like to phase out (probably making it an
> optional plugin) yield-mediated generative tests once
> i implemented a mechanism based on
> http://codespeak.net/py/trunk/test/funcargs.html
> that allows to invoke a test function repeatedly
> with multiple parameter sets.

I'll have to read that more carefully and reply later, its longer than  
I can grok while replying now. :)

-Doug




More information about the testing-in-python mailing list