[pytest-dev] parametrize and ids

Brianna Laugher brianna.laugher at gmail.com
Thu Jun 6 08:44:15 CEST 2013


On 29 May 2013 17:48, holger krekel <holger at merlinux.eu> wrote:

> agreed.   One a sidenote, yesterday i introduced a briefer way to
> specify argument names.  Your example would start like this:
>
>     @pytest.mark.parametrize("wx,expectedCoverage,expectedTrend", ...)
>
> and you can also have spaces after the commas if you prefer.
>

I noticed that :) looks good. I think of parametrize like specifying
namedtuples so it is a good improvement.


> I'd recommend to write a wrapper "@myparametrize" which generates a
> pytest.mark.parametrize() instance in the end.  This way you could use
> and consolidate your API ideas in real life with today's pytest in real
> life before aiming for pytest inclusion.
>

Great idea. I discussed my idea with my workmate and he immediately
suggested I use a dictionary, with the key being the test name and the
value being the argvalue (test data). In doing that the test order is not
guaranteed, but one could use an OrderedDict I suppose if that was
important.

I have put up a working example here for anyone who is interested:
https://gist.github.com/pfctdayelise/5719730

cheers
Brianna


-- 
They've just been waiting in a mountain for the right moment:
http://modernthings.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20130606/fea49a3b/attachment.html>


More information about the Pytest-dev mailing list