Skip to content

Can I do order annotations at the module level? #124

Answered by mrbean-bremen
red8888 asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks, good point! I hadn't thought about this at the time.

What this does is essentially putting the marker on all tests in the module, and as the order is preserved for similar markers this will also work.
You still have to use --order-group-scope=module as mentioned, but you can change test_last.py to:

import pytest

pytestmark = [pytest.mark.order(-1)]

def test_1():
    pass

def test_2():
    pass

def test_3():
    pass

so there is no need to put the marker onto the last test.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@mrbean-bremen
Comment options

Answer selected by red8888
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #123 on May 22, 2024 18:28.