[py-dev] How to run a given test by name?

Baptiste Lepilleur baptiste.lepilleur at gmail.com
Sun May 1 12:41:06 CEST 2011


options -k was what I was looking for. I somehow managed to miss it.

Thanks,
Baptiste.

2011/5/1 holger krekel <holger at merlinux.eu>

> On Sun, May 01, 2011 at 12:08 +0200, Baptiste Lepilleur wrote:
> > typically when troubleshooting multiple test failures, I want to be able
> to
> > run a single parametrized test case.
> >
> > How can you tell py.test to run only tests matching a specific name.
> >
> > For example, I'd like to be able to run:
> >
> > py.test src --filter-by-name "test_mandatory_property[ZText]"
> >
> > This would run all tests with a name
> > matching "test_mandatory_property[ZText]".
> >
> > Is there a way to do that?
>
> two possibilites.  You can do a run with "py.test -rf" which will report
> test IDs
> for all failures.  You can then pass one or more of those IDs to a py.test
> invocation.
> Secondly you can use the keyword option  try something like "-k ZTEXT", see
> option help.
>
> holger
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20110501/35fe9a99/attachment.html>


More information about the Pytest-dev mailing list