pytest-dev / pytest-repeat

pytest plugin for repeating test execution
https://pypi.python.org/pypi/pytest-repeat/
Other
169 stars 27 forks source link

Fixes #2, use an indirect param rather than metafunc.addcall #4

Closed tomviner closed 8 years ago

tomviner commented 8 years ago

Thanks to a suggestion from @RonnyPfannschmidt we replace metafunc.addcall with a new approach: an indirectly parametrized autouse fixture with a value like range(count).

This allows pytest-repeat to work with parametrized tests and fixtures (#2)

We also address #3. It's not possible to repeat unittest style tests, but we make sure not to error, and raise a warning about this not being supported.

tomviner commented 8 years ago

I'm also open to not raising a warning for unittest style tests.

davehunt commented 8 years ago

This is failing in Python 2.6, and against pytest < 2.7. If possible we should continue to support these versions, though I'm also not against dropping support for pytest < 2.7 so long as we update the dependencies.

davehunt commented 8 years ago

The ability to use a callable for the test IDs was added in 2.7.0, which explains why this is failing with earlier versions. I'm happy with making 2.7.3 the minimum supported version and dropping tests on earlier versions.

davehunt commented 8 years ago

I'm not sure with the tests are failing on Python 2.6... @tomviner any ideas?

tomviner commented 8 years ago

Ok tests fixed. See latest commit. The issues were:

test_unittest_test.py:4: ClassStyleTest.test_this PASSED

which didn't match: *test_unittest_test.py::ClassStyleTest::test_this PASSED*

So I've updated the pattern to be flexible to match previous and current output.

Also I found out you can escape fnmatch meta characters by wrapping in square brackets.

RonnyPfannschmidt commented 8 years ago

@davehunt since the list is known in advance, how about just generating the id list in advance and passing the result to ids?

tomviner commented 8 years ago

Take a look at the diff now, @RonnyPfannschmidt that's exactly what I did.

davehunt commented 8 years ago

Thanks @tomviner, I'll prepare a release.

davehunt commented 8 years ago

Released v0.3.0