From 136f453da4978833c55e10c4d360eb32ca43f77c Mon Sep 17 00:00:00 2001 From: Stefaan Lippens Date: Mon, 19 Aug 2024 14:22:48 +0200 Subject: [PATCH] Move OpeneoApiCollectionTests under openeo_test_suite/lib Better separation of actual tests and reusable components Also make sure the asserts in OpeneoApiCollectionTests are rewritten for better reporting quality --- src/openeo_test_suite/lib/__init__.py | 6 ++++++ .../collection_metadata.py} | 2 +- src/openeo_test_suite/tests/collections/test_collections.py | 4 +--- 3 files changed, 8 insertions(+), 4 deletions(-) rename src/openeo_test_suite/{tests/collections/openeo_api_collection_tests.py => lib/collection_metadata.py} (98%) diff --git a/src/openeo_test_suite/lib/__init__.py b/src/openeo_test_suite/lib/__init__.py index e69de29..3152fb9 100644 --- a/src/openeo_test_suite/lib/__init__.py +++ b/src/openeo_test_suite/lib/__init__.py @@ -0,0 +1,6 @@ +import pytest + +# Register some helper modules for assert rewriting to improve test reporting +pytest.register_assert_rewrite( + "openeo_test_suite.lib.collection_metadata", +) diff --git a/src/openeo_test_suite/tests/collections/openeo_api_collection_tests.py b/src/openeo_test_suite/lib/collection_metadata.py similarity index 98% rename from src/openeo_test_suite/tests/collections/openeo_api_collection_tests.py rename to src/openeo_test_suite/lib/collection_metadata.py index e261a53..8a67f40 100644 --- a/src/openeo_test_suite/tests/collections/openeo_api_collection_tests.py +++ b/src/openeo_test_suite/lib/collection_metadata.py @@ -5,7 +5,7 @@ class OpeneoApiCollectionTests: - # TODO: This OOP pattern is not necessary, this can just be a bunch of functions. These addition layers leak into the test report, making it harder to read. + # TODO: This OOP pattern is not necessary, this can just be a bunch of functions. These additional layers leak into the test report, making it harder to read. # TODO: Also, it's not necessary to define this in a separate file, it can just be a function in the test file def __init__(self, collection): self.test_stac_version(collection) diff --git a/src/openeo_test_suite/tests/collections/test_collections.py b/src/openeo_test_suite/tests/collections/test_collections.py index 68c5abd..6b29f96 100644 --- a/src/openeo_test_suite/tests/collections/test_collections.py +++ b/src/openeo_test_suite/tests/collections/test_collections.py @@ -5,10 +5,8 @@ from stac_validator import stac_validator from openeo_test_suite.lib.backend_under_test import get_collection_ids +from openeo_test_suite.lib.collection_metadata import OpeneoApiCollectionTests from openeo_test_suite.lib.validate_stac import validate_stac_dict -from openeo_test_suite.tests.collections.openeo_api_collection_tests import ( - OpeneoApiCollectionTests, -) _log = logging.getLogger(__name__)