From: Aleš Mrázek Date: Wed, 5 Aug 2026 22:33:49 +0000 (+0200) Subject: tests/python: remove __init__.py X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fenvironments%2Fdocs-tests-python-sd9hmg%2Fdeployments%2F9772;p=thirdparty%2Fknot-resolver.git tests/python: remove __init__.py Moved global validation context to individual modules. --- diff --git a/tests/python/knot_resolver/__init__.py b/tests/python/knot_resolver/__init__.py deleted file mode 100644 index 5b82d3be8..000000000 --- a/tests/python/knot_resolver/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -from pathlib import Path - -from knot_resolver.datamodel.globals import Context, set_global_validation_context - -set_global_validation_context(Context(Path("."), False)) diff --git a/tests/python/knot_resolver/datamodel/test_config_schema.py b/tests/python/knot_resolver/datamodel/test_config_schema.py index 6d55da378..79488e5c0 100644 --- a/tests/python/knot_resolver/datamodel/test_config_schema.py +++ b/tests/python/knot_resolver/datamodel/test_config_schema.py @@ -1,8 +1,10 @@ import inspect import json +from pathlib import Path from typing import Any, Dict, Type, cast from knot_resolver.datamodel import KresConfig +from knot_resolver.datamodel.globals import Context, set_global_validation_context from knot_resolver.datamodel.lua_schema import LuaSchema from knot_resolver.utils.modeling import BaseSchema from knot_resolver.utils.modeling.types import ( @@ -16,6 +18,8 @@ from knot_resolver.utils.modeling.types import ( is_union, ) +set_global_validation_context(Context(Path("."), False)) + def test_config_check_str_type(): # check that there is no 'str' type in datamodel schema (except for LuaSchema diff --git a/tests/python/knot_resolver/datamodel/types/test_custom_types.py b/tests/python/knot_resolver/datamodel/types/test_custom_types.py index c3c3ff5ba..9ad45f68c 100644 --- a/tests/python/knot_resolver/datamodel/types/test_custom_types.py +++ b/tests/python/knot_resolver/datamodel/types/test_custom_types.py @@ -1,11 +1,13 @@ import ipaddress import random import string +from pathlib import Path from typing import Any import pytest from pytest import raises +from knot_resolver.datamodel.globals import Context, set_global_validation_context from knot_resolver.datamodel.types import ( Dir, DomainName, @@ -27,6 +29,8 @@ from knot_resolver.datamodel.types import ( ) from knot_resolver.utils.modeling import BaseSchema +set_global_validation_context(Context(Path("."), False)) + def _rand_domain(label_chars: int, levels: int = 1) -> str: return "".join( diff --git a/tests/python/knot_resolver/test_config_store.py b/tests/python/knot_resolver/test_config_store.py index c12fe54be..10b15e577 100644 --- a/tests/python/knot_resolver/test_config_store.py +++ b/tests/python/knot_resolver/test_config_store.py @@ -1,8 +1,13 @@ +from pathlib import Path + import pytest from knot_resolver.datamodel.config_schema import KresConfig +from knot_resolver.datamodel.globals import Context, set_global_validation_context from knot_resolver.manager.config_store import ConfigStore, only_on_real_changes_update +set_global_validation_context(Context(Path("."), False)) + @pytest.mark.asyncio # type: ignore async def test_only_once():