1

I am using pytest for test automation and some of my tests require validation/assert ( post-process verification) after 10 minutes). I do not want to block my tests for 10 minutes and keep other tests in the queue. Consider a simple example below:

def fun_10_min_delay_verification():
    time.sleep(300)
    return True


def test_1st_test():
    print("Running 1st test")
    assert fun_10_min_delay_verification
    
    
def test_2nd_test_without_delay():
    print("Running 2nd test. I want to start this test ASAP instead of waiting for slow task")
  

I tried to use asyncio to put my delayed assertion but no luck. Any suggestions to run the validation/assertion in async mode to unblock the remaining test execution?

1 Answer 1

1

I would advise using pytest-xdist, which is a pytest plugin to runs test in a parallel fashion: https://github.com/pytest-dev/pytest-xdist

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.