From 42cc88b61a8c03262c944f4e2815a9ac38f7ffab Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Sat, 4 Nov 2023 23:14:54 +0100 Subject: [PATCH] Shore container time in test conftest --- .docker/tests/conftest.py | 8 +++++--- .docker/tests/test_aiida.py | 7 ++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.docker/tests/conftest.py b/.docker/tests/conftest.py index 2d222353ac..edcec3183b 100644 --- a/.docker/tests/conftest.py +++ b/.docker/tests/conftest.py @@ -22,9 +22,11 @@ def docker_compose(docker_services): return docker_services._docker_compose -@pytest.fixture -def timeout(): - """Container and service startup timeout""" +@pytest.fixture(scope='session', autouse=True) +def _services_prepare_timeout(): + """Container and service startup timeout, before tests session starts + waiting for the containers to be ready. + """ return 30 diff --git a/.docker/tests/test_aiida.py b/.docker/tests/test_aiida.py index 0ab8860231..95956f9d1f 100644 --- a/.docker/tests/test_aiida.py +++ b/.docker/tests/test_aiida.py @@ -1,7 +1,6 @@ # -*- coding: utf-8 -*- # pylint: disable=missing-docstring import json -import time from packaging.version import parse import pytest @@ -22,8 +21,7 @@ def test_correct_pgsql_version_installed(aiida_exec, pgsql_version, variant): assert parse(info['version']).major == parse(pgsql_version).major -def test_verdi_status(aiida_exec, container_user, timeout): - time.sleep(timeout) +def test_verdi_status(aiida_exec, container_user): output = aiida_exec('verdi status', user=container_user).decode().strip() assert 'Connected to RabbitMQ' in output assert 'Daemon is running' in output @@ -32,8 +30,7 @@ def test_verdi_status(aiida_exec, container_user, timeout): assert 'Warning' not in output -def test_computer_setup_success(aiida_exec, container_user, timeout): - time.sleep(timeout) +def test_computer_setup_success(aiida_exec, container_user): output = aiida_exec('verdi computer test localhost', user=container_user).decode().strip() assert 'Success' in output