[py-dev] How to run a given test by name?
holger at merlinux.eu
Sun May 1 12:22:41 CEST 2011
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.
More information about the Pytest-dev