[py-dev] py.test: customizing collector

Ian Bicking ianb at colorstudy.com
Sun Nov 21 21:02:29 CET 2004


Ian Bicking wrote:
> def add_params(params):
>     """
>     A decorator, e.g.::
> 
>         @add_params([(1, 'i'), (2, 'ii'),])
>         def test_roman(input, output):
>             assert toRoman(input) == output
>     """
>     def decorator(func):
>         return ParamItemizer(func, params)
>     return decorator

Extending this idea, other similar decorators could read the parameters 
from other data sources, like a spreadsheet or HTML document, similar to 
Fitnesse (http://www.fitnesse.org/), e.g., 
@add_html_params('test_document.html', id='test_table1')

-- 
Ian Bicking  /  ianb at colorstudy.com  / http://blog.ianbicking.org



More information about the Pytest-dev mailing list