[pytest-dev] parametrization ids simplification/generalization
holger krekel
holger at merlinux.eu
Tue Oct 22 09:59:02 CEST 2013
On Tue, Oct 22, 2013 at 11:57 +1100, Brianna Laugher wrote:
> I don't mind losing the IDs constructed from values, assuming it will still
> be possible to specify IDs if using metafunc.addcall. But if we are going
> to lose the IDs from values then they should probably just be plain
> integers (as happens when using metafunc.addall without specifying id) -
> having names like test_some[arg0-arg1-arg2], test_some[arg3-arg4-arg5] etc
> is totally pointless.
Including the argnames gives more context, no? Something like
test_some[0-1-2] gives less. More importantly, selecting a specifically
parametrized test works with "py.test -k arg0" whereas "py.test -k 1"
would not work, i am afraid.
best,
holger
> thanks
> Brianna
>
>
>
> On 21 October 2013 23:12, holger krekel <holger at merlinux.eu> wrote:
>
> > Hi Brianna, all,
> >
> > I am thinking about constructing ids for parametrized tests using
> > argname/valindex, i.e. not use the actual parametrization
> > values. The latter causes some problems (among them also issue357)
> > and generally doesn't allow to distinguish the two tests in:
> >
> > @pytest.mark.parametrize("arg", [1,1])
> > def test_some(arg):
> > pass
> >
> > Currently this gives two identical test ids "test_some[1]".
> > With the new scheme this gives:
> >
> > test_some[arg0]
> > test_some[arg1]
> >
> > Such a scheme would guarantee unique IDs. The scheme is already
> > used for user instances.
> >
> > Note that when you get a traceback you would still see the actual
> > argument values in the traceback.
> >
> > Any objections?
> >
> > holger
> >
>
>
>
> --
> They've just been waiting in a mountain for the right moment:
> http://modernthings.org/
More information about the Pytest-dev
mailing list