Test case execution order in pytest

前端 未结 7 1830
情书的邮戳
情书的邮戳 2020-11-28 12:01

I am using pytest. I have two files in a directory. In one of the files there is a long running test case that generates some output. In the other file there is a test case

7条回答
  •  -上瘾入骨i
    2020-11-28 12:10

    Maybe you can consider using dependency pytest plugin, where you can set the test dependencies easily:

    @pytest.mark.dependency()
    def test_long():
        pass
    
    @pytest.mark.dependency(depends=['test_long'])
    def test_short():
        pass
    

    This way test_short will only execute if test_long is success and force the execution sequence as well.

提交回复
热议问题