From ef1ea4b4dd1016082c7d8199364cfe3e8a2916e6 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Mon, 10 Jul 2023 14:36:42 +0200 Subject: [PATCH] #1248: Check container status before test functions --- tests/functional/conftest.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index 2ff5fddf..8a5601f7 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -1,6 +1,20 @@ import pytest +from pytest_docker_pexpect.docker import run as pexpect_docker_run, \ + stats as pexpect_docker_stats + @pytest.fixture(autouse=True) def build_container_mock(mocker): return mocker.patch('pytest_docker_pexpect.docker.build_container') + + +def run_side_effect(*args, **kwargs): + container_id = pexpect_docker_run(*args, **kwargs) + pexpect_docker_stats(container_id) + return container_id + + +@pytest.fixture(autouse=True) +def run_mock(mocker): + return mocker.patch('pytest_docker_pexpect.docker.run', side_effect=run_side_effect)