I want every pytest test run simultaneously with a function recording video. I want to somehow make pytest do something like this
test_function1 test_function2 test_function
When pytest would call every function for execution it would couple it with record_video(). Like test_function{n} record_video()
In the end it woud return a report on how the test was executed and a .mp4 file with a recording.
How to achieve that? I guess it should be possible somehow
CodePudding user response:
Fixtures are a perfect use case for this.
See the following hypothetical example --
import pytest
@pytest.fixture
def record_video():
record.start()
yield
record.stop()
@pytest.fixture(scope="session")
def generate_report():
yield
report.make()