From f1535d043891b8ad000fdce938ed5c9e9d02d11d Mon Sep 17 00:00:00 2001 From: Tayfun Bocek Date: Wed, 13 Mar 2024 21:02:55 +0300 Subject: [PATCH] Use single client for all tests. --- tests/api_defs/__init__.py | 1 + tests/{test_api_defs => api_defs}/test_server_stats.py | 4 +--- tests/{test_api_defs => api_defs}/test_stock_status.py | 6 ++---- tests/products/__init__.py | 1 + tests/{test_products => products}/test_server.py | 5 ++--- 5 files changed, 7 insertions(+), 10 deletions(-) create mode 100644 tests/api_defs/__init__.py rename tests/{test_api_defs => api_defs}/test_server_stats.py (91%) rename tests/{test_api_defs => api_defs}/test_stock_status.py (93%) create mode 100644 tests/products/__init__.py rename tests/{test_products => products}/test_server.py (96%) diff --git a/tests/api_defs/__init__.py b/tests/api_defs/__init__.py new file mode 100644 index 0000000..8f8b527 --- /dev/null +++ b/tests/api_defs/__init__.py @@ -0,0 +1 @@ +from ..client import client diff --git a/tests/test_api_defs/test_server_stats.py b/tests/api_defs/test_server_stats.py similarity index 91% rename from tests/test_api_defs/test_server_stats.py rename to tests/api_defs/test_server_stats.py index 530b09b..c10e93f 100644 --- a/tests/test_api_defs/test_server_stats.py +++ b/tests/api_defs/test_server_stats.py @@ -1,11 +1,9 @@ import pytest -from vshieldpy.client import Client +from . import client pytestmark = pytest.mark.anyio -client = Client() - async def test_server_stats(): server_stats = await client.fetch_server_stats(1) diff --git a/tests/test_api_defs/test_stock_status.py b/tests/api_defs/test_stock_status.py similarity index 93% rename from tests/test_api_defs/test_stock_status.py rename to tests/api_defs/test_stock_status.py index 273a17b..b261531 100644 --- a/tests/test_api_defs/test_stock_status.py +++ b/tests/api_defs/test_stock_status.py @@ -2,12 +2,10 @@ from vshieldpy.api_defs.locations import Locations from vshieldpy.api_defs.plans import Plans -from vshieldpy.client import Client - -pytestmark = pytest.mark.anyio +from . import client -client = Client() +pytestmark = pytest.mark.anyio async def test_stock_status_check_stock(): diff --git a/tests/products/__init__.py b/tests/products/__init__.py new file mode 100644 index 0000000..8f8b527 --- /dev/null +++ b/tests/products/__init__.py @@ -0,0 +1 @@ +from ..client import client diff --git a/tests/test_products/test_server.py b/tests/products/test_server.py similarity index 96% rename from tests/test_products/test_server.py rename to tests/products/test_server.py index eee100b..fbdbe77 100644 --- a/tests/test_products/test_server.py +++ b/tests/products/test_server.py @@ -6,12 +6,11 @@ from vshieldpy.api_defs.operating_systems import OperatingSystems from vshieldpy.api_defs.plans import Plans from vshieldpy.api_defs.status_codes import Status -from vshieldpy.client import Client from vshieldpy.products import Server, Servers -pytestmark = pytest.mark.anyio +from . import client -client = Client() +pytestmark = pytest.mark.anyio SERVERS: tuple[Server, ...] = ( Server(