[pytest-dev] parametrize + xfail
holger krekel
holger at merlinux.eu
Tue Apr 23 12:25:55 CEST 2013
On Tue, Apr 23, 2013 at 19:06 +1000, Brianna Laugher wrote:
> On 23 April 2013 17:27, holger krekel <holger at merlinux.eu> wrote:
>
> > Hi Brianna,
> >
> > first off a request to you :)
> >
> > You filed https://bitbucket.org/hpk42/pytest/issue/279/ and Floris
> > improved assertion reporting accordingly. Could you provide testing
> > and feedback?
> >
>
> I will definitely do that, it escaped my attention somehow!
>
thanks.
> I guess this is possible. I'd probably prefer something like:
> >
> @py.test.mark.parametrize(('duration', 'expectedBrackets'), [
> > pytest.mark.xfail((7, [None, None, None, 7])),
> > pytest.mark.xfail((19, [None, 7, 6, 6])),
> > (24, [6, 6, 6, 6]),
> > (23, [6, 6, 6, 6]),
> > (25, [6, 6, 6, 6]),
> >
> > and is a bit easier to switch between xfail and not. If you like
> > that as well please open an issue and at best try to come up with
> > a patch :)
> >
>
> That is fine by me, I will try to see what I can do. :)
The parametrization code is in _pytest/python.py and it's a bit tricky
because of its support for old-style (addcall) and new-style (parametrize)
parametrization and because it integrates with the general fixture mechanism.
IOW, please don't feel bad if you get lost in that code :)
>
> >
> > > Also while I'm at it, it could be good for pytest to issue a warning if
> > > someone uses a mark called parameterize, parametrise or parameterise,
> > > because I've been caught pondering why a mark wasn't working properly at
> > > least once :)
> >
> > Did you try running with "py.test --strict" (which you can make a general
> > default through "addopts" in a pytest config file)? It bails out if you
> > use non-registered markers.
> >
>
> We don't use registered markers (partly because we use marks to refer to
> bug tracker items), so that wouldn't help. But it occurs to me there would
> be a hook somewhere where I could inspect the marks and raise some kind of
> alert for myself, don't need pytest to do it. I will look into that. :)
I recommend thinking about a way to use strict registration.
We could think about allowing wild-cards in mark registrations.
So if you have "bugNNN" you could register "bug*".
cheers,
holger
> thanks!
> Brianna
>
>
> --
> They've just been waiting in a mountain for the right moment:
> http://modernthings.org/
> _______________________________________________
> Pytest-dev mailing list
> Pytest-dev at python.org
> http://mail.python.org/mailman/listinfo/pytest-dev
More information about the Pytest-dev
mailing list