Closed tomviner closed 8 years ago
I'm also open to not raising a warning for unittest style tests.
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.
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.
I'm not sure with the tests are failing on Python 2.6... @tomviner any ideas?
Ok tests fixed. See latest commit. The issues were:
parser.addoption(... default='1' ...)
was setting count to the string '1'
on Python 2.6.format
doesn't handle empty {}
on Python 2.6parametrize(ids=
can't take a function in prevous pytest versionstest_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.
@davehunt since the list is known in advance, how about just generating the id list in advance and passing the result to ids?
Take a look at the diff now, @RonnyPfannschmidt that's exactly what I did.
Thanks @tomviner, I'll prepare a release.
Thanks to a suggestion from @RonnyPfannschmidt we replace
metafunc.addcall
with a new approach: an indirectly parametrized autouse fixture with a value likerange(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.