Doesn't work when using inside a class
If my code is something like this:
class Test(TestCase):
i = 0
@pytest.mark.run(order=1)
def test_c(self):
assert self.i == 0
self.i += 1
@pytest.mark.run(order=2)
def test_b(self):
assert self.i == 1
self.i += 1
@pytest.mark.run(order=3)
def test_a(self):
assert self.i == 2
self.i += 1
It says 'Empty test suite.', and when I change the marker into something like @pytest.mark.first, it still doesn't work. It seems to me that pytest doesn't obey these marks anymore.
How do I solve this ? or I'm doing it wrongly ?
This definitely looks like a bug. Probably a few bugs.
Try starting the order from 0. It looks like there are problems when the "order" ordinal is higher than the number of tests, and it's zero-indexed.
Thanks for reporting this. I'll need to address this in the next release.
using 'pytest-ordering 0.5' with index starts at 0 works well for me.
Thanks for pytest-ordering. :)