From 945a4d2b2f0a799bcd3c0fe448da210c2d869d54 Mon Sep 17 00:00:00 2001 From: sethg Date: Mon, 20 Oct 2025 17:57:35 +0200 Subject: [PATCH] Skip connected systems tests if the server is unavailable --- tests/test_ogcapi_connectedsystems_osh.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/test_ogcapi_connectedsystems_osh.py b/tests/test_ogcapi_connectedsystems_osh.py index 5b9299f7..dde37340 100644 --- a/tests/test_ogcapi_connectedsystems_osh.py +++ b/tests/test_ogcapi_connectedsystems_osh.py @@ -9,19 +9,20 @@ from datetime import datetime import json +from tests.utils import service_ok + import pytest from owslib.ogcapi.connectedsystems import Commands, ControlChannels, Datastreams, Deployments, Observations, \ Properties, SamplingFeatures, SystemEvents, SystemHistory, Systems from owslib.util import Authentication +# Directs to OSH (Open Sensor Hub) hosted test server +TEST_URL = 'http://34.67.197.57:8585/sensorhub/api/' @pytest.fixture(scope="session") def fixtures(): class OSHFixtures: - NODE_TEST_OK_URL = 'http://34.67.197.57:8585/sensorhub/test' - # Directs to OSH hosted test server - TEST_URL = 'http://34.67.197.57:8585/sensorhub/api/' auth = Authentication('auto_test', 'automated_tester24') sml_headers = {'Content-Type': 'application/sml+json'} json_headers = {'Content-Type': 'application/json'} @@ -214,6 +215,7 @@ def delete_all_sampling_features(self): yield OSHFixtures() +@pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable") class TestSystems: @pytest.mark.online def test_system_readonly(self, fixtures): @@ -255,6 +257,7 @@ def test_system_functions(self, fixtures): assert res == {} +@pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable") class TestDeployments: @pytest.mark.skip(reason="Skip transactional test") def test_deployment_create(self, fixtures): @@ -279,6 +282,7 @@ def test_deployment_delete(self, fixtures): assert res is not None +@pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable") class TestSamplingFeatures: @pytest.mark.online def test_sampling_features_readonly(self, fixtures): @@ -324,6 +328,7 @@ def test_sampling_features_all(self, fixtures): assert res == {'items': []} +@pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable") class TestDatastreams: @pytest.mark.online def test_datastreams_readonly(self, fixtures): @@ -369,6 +374,7 @@ def test_all_ds_functions(self, fixtures): assert ds_delete == {} +@pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable") class TestObservations: @pytest.mark.online def test_observations_readonly(self, fixtures): @@ -409,6 +415,7 @@ def test_observations(self, fixtures): fixtures.delete_all_systems() +@pytest.mark.skipif(not service_ok(TEST_URL), reason="OSH server is unreachable") class TestSystemHistory: @pytest.mark.online def test_system_history(self, fixtures):