I'd suggest you to go with higher level testing approach using testdir
fixture, which is common for pytest plugins and available via pytester
plugin:
pytest_plugins = "pytester"
def test_something(testdir):
"""Test some thing."""
testdir.makepyfile("""
import pytest
@pytest.mark.some
def test_some():
assert True
@pytest.mark.some_thing_else
def test_some_thing_else():
assert True
""")
result = testdir.runpytest('-vv')
assert result.stdout.lines[-4:-2] == [
u'test_something.py::test_some PASSED',
u'test_something.py::test_some_thing_else PASSED'
]
so you can easily have multiple permutations of tests and their markers in the source and by asserting the output lines you assert the actual ordering.