pytest-ordering icon indicating copy to clipboard operation
pytest-ordering copied to clipboard

Implement "before" and "after" markers

Open ftobia opened this issue 12 years ago • 3 comments

Something like:

@pytest.mark.run_before(test_name='test_foo')
def test_bar():
    assert True

I welcome ideas for different / better APIs.

ftobia avatar Mar 18 '14 15:03 ftobia

I think I like this better:

@pytest.mark.run(before='test_foo')
def test_bar():
    assert True

It's more declarative and it means pytest-ordering can register a single marker that does all the work.

ftobia avatar Mar 27 '14 02:03 ftobia

I like this concept as it would be much easier to maintain sequence of tests by reference rather than having to specify a static sequence number. i.e. if i have stuff in a static order using numbers then i need to insert another test in between two others then i have a challenge as i may need to renumber all my tests which makes it hard to maintain tests.

My preference is @pytest.mark.run(before='test_foo')

Bengreen avatar Jun 29 '16 22:06 Bengreen

Call this marker "order" instead of "run" per #38

ftobia avatar Oct 09 '19 14:10 ftobia