Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace pytest-docker-compose with pytest-docker plugin #484

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pytest
pytest-cov
pytest-docker-compose
pytest-docker
pytest-dependency
pytest-order
so3g
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_cryomech_cpa_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

# Set the OCS_CONFIG_DIR so we read the local default.yaml file always
os.environ['OCS_CONFIG_DIR'] = os.getcwd()

Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_hwp_pid_agent_integration.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
'../socs/agents/hwp_pid/agent.py', 'hwp_pid_agent', args=['--log-dir', './logs/'])
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_hwp_pmx_agent_integration.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
'../socs/agents/hwp_pmx/agent.py', 'hwp_pmx_agent', args=['--log-dir', './logs/'])
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_ibootbar_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture
Expand All @@ -14,8 +15,6 @@

from socs.snmp import SNMPTwister

pytest_plugins = "docker_compose"

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
"../socs/agents/ibootbar/agent.py",
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_ls240_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
'../socs/agents/lakeshore240/agent.py', 'ls240_agent')
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_ls372_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

# Set the OCS_CONFIG_DIR so we read the local default.yaml file always
os.environ['OCS_CONFIG_DIR'] = os.getcwd()

Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_ls425_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
'../socs/agents/lakeshore425/agent.py', 'ls425_agent')
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_pfeiffer_tc400_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = ("docker_compose")

# Set the OCS_CONFIG_DIR so we read the local default.yaml file always
os.environ['OCS_CONFIG_DIR'] = os.getcwd()

Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_pfeiffer_tpg366_agent_integration.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = "docker_compose"

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
"../socs/agents/pfeiffer_tpg366/agent.py",
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_pysmurf_monitor_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

pytest_plugins = "docker_compose"

TMPFILE = '/tmp/pytest-socs/suprsync.db'

wait_for_crossbar = create_crossbar_fixture()
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_scpi_psu_agent_integration.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

from socs.testing.device_emulator import create_device_emulator

pytest_plugins = "docker_compose"

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
"../socs/agents/scpi_psu/agent.py",
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_synacc_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import pytest
from flask import request
from http_server_mock import HttpServerMock
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture

pytest_plugins = "docker_compose"

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
"../socs/agents/synacc/agent.py",
Expand Down
3 changes: 1 addition & 2 deletions tests/integration/test_ups_agent_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

import ocs
import pytest
from integration.util import docker_compose_file # noqa: F401
from integration.util import create_crossbar_fixture
from ocs.base import OpCode
from ocs.testing import create_agent_runner_fixture, create_client_fixture
from snmpsim.commands import responder

pytest_plugins = "docker_compose"

wait_for_crossbar = create_crossbar_fixture()
run_agent = create_agent_runner_fixture(
"../socs/agents/ups/agent.py",
Expand Down
11 changes: 10 additions & 1 deletion tests/integration/util.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pytest
from ocs.testing import check_crossbar_connection

Expand All @@ -11,11 +13,18 @@ def create_crossbar_fixture():
# @pytest.fixture(scope="function")
# def wait_for_crossbar(function_scoped_container_getter):
@pytest.fixture(scope="session")
def wait_for_crossbar(session_scoped_container_getter):
def wait_for_crossbar(docker_services):
"""Wait for the crossbar server from docker-compose to become
responsive.
"""
check_crossbar_connection()

return wait_for_crossbar


# Overrides the default location that pytest-docker looks for the compose file.
# https://pypi.org/project/pytest-docker/
@pytest.fixture(scope="session")
def docker_compose_file(pytestconfig):
return os.path.join(str(pytestconfig.rootdir), "docker-compose.yml")