diff --git a/src/tests/conftest.py b/src/tests/conftest.py index 14eeae5..7f190e9 100644 --- a/src/tests/conftest.py +++ b/src/tests/conftest.py @@ -1,4 +1,6 @@ """General pytest configuration, including fixtures.""" +import os +import sys from typing import Callable, Optional import pytest @@ -53,3 +55,25 @@ def eddn_message() -> Callable: return test_messages.get(msg_type) return _method + + +@pytest.fixture +def fix_sys_path() -> None: + """Set up an eddn.Gateway import.""" + # Tests don't include the directory that `pytest` is run from on sys.path + sys.path.append(os.getcwd()) + + +@pytest.fixture(scope="session") +def eddn_gateway(): + """Set up an eddn.Gateway import.""" + import eddn.Gateway + + class CLArgs: + config = False + + cl_args = CLArgs() + eddn.Gateway.load_config(cl_args) + eddn.Gateway.configure() + + return eddn.Gateway diff --git a/src/tests/gateway/test_parse_and_error_handle.py b/src/tests/gateway/test_parse_and_error_handle.py index eb69940..43dc81c 100644 --- a/src/tests/gateway/test_parse_and_error_handle.py +++ b/src/tests/gateway/test_parse_and_error_handle.py @@ -1,32 +1,6 @@ """Tests for eddn.Gateway.parse_and_error_handle.""" -import os -import sys from typing import Callable -import pytest - - -@pytest.fixture -def fix_sys_path() -> None: - """Set up an eddn.Gateway import.""" - # Tests don't include the directory that `pytest` is run from on sys.path - sys.path.append(os.getcwd()) - - -@pytest.fixture(scope='module') -def eddn_gateway(): - """Set up an eddn.Gateway import.""" - import eddn.Gateway - - class CLArgs: - config = False - - cl_args = CLArgs() - eddn.Gateway.load_config(cl_args) - eddn.Gateway.configure() - - return eddn.Gateway - def test_invalid_json(fix_sys_path, eddn_gateway, eddn_message: Callable) -> None: """Test invalid JSON input."""