Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't work when using inside a class #18

Open
phizaz opened this issue Jun 25, 2015 · 2 comments
Open

Doesn't work when using inside a class #18

phizaz opened this issue Jun 25, 2015 · 2 comments
Labels

Comments

@phizaz
Copy link

phizaz commented Jun 25, 2015

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 ?

@ftobia
Copy link
Owner

ftobia commented Jun 28, 2015

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.

@ftobia ftobia added the bug label Aug 5, 2015
@azzamsa
Copy link

azzamsa commented Jul 5, 2018

using 'pytest-ordering 0.5' with index starts at 0 works well for me.

Thanks for pytest-ordering. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants