[py-dev] Help understanding pytest_generate_tests related error message

Ronny Pfannschmidt Ronny.Pfannschmidt at gmx.de
Sun May 1 12:29:09 CEST 2011


On Sun, 2011-05-01 at 11:59 +0200, Baptiste Lepilleur wrote:
> 2011/4/29 Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
>         
>         On Fri, 2011-04-29 at 22:18 +0200, Baptiste Lepilleur wrote:
>         > [...]
>         > I'm not sure how I would go about that: it would means going
>         through
>         > the VALIDATION_SCENARIOS test data for each test function,
>         and
>         > duplicating some setup code of the test function...
>         
>         
>         unless i'm misstaken, only the creation of the class is shared
>         which means that could actually be something like a funcarg or
>         a param
>         to a funcarg
> 
> 
> Indeed. I did the split but I feel that the scenario types/test
> function association is very clumsy:
> http://pastebin.com/gTsVJLWK
> 
> 
> Is there a simpler way to do this? Ideally, I'd rather have  a simple
> way to associate a test function with a test parameter generator. I'm
> thinking of something like this for example:
> 
> 
> @parametrized( _generate_property_validation_tests, ['good_values'] )
> def test_property_validation_good_values( scenario_type, dbo_class,
> value, good_value ):
>    ...
> 
> 
> The parametrized decorator would
> call _generate_property_validation_tests( metafunc, ['good_values'] ). 
> 
> 
> Is there a way to do that?
you can use the pytest.mark  tool to make a decorator which annotates
the value types nicely

-- Ronny
> 
> 
> Thanks,
> Baptiste.
>  
>         
>         -- Ronny
>         
>         

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20110501/5edd0e49/attachment.pgp>


More information about the Pytest-dev mailing list