Skip to content

Commit 43dbf76

Browse files
authored
Speed up unit tests (#975)
1 parent d74bb5d commit 43dbf76

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/uwtools/config/jinja2.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,8 @@ def _deref_render(val: str, context: dict, local: dict | None = None) -> str:
295295
:param local: Local sibling values to use if a match is not found in context.
296296
:return: The rendered value (potentially unchanged).
297297
"""
298+
if not any(marker in val for marker in ("{{", "{%", "{#")):
299+
return val
298300
env = _register_filters(Environment(undefined=StrictUndefined))
299301
template = env.from_string(val)
300302
context = _update_context(context, local)

src/uwtools/tests/support.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
if TYPE_CHECKING:
99
from collections.abc import Callable
1010

11-
import yaml
11+
import json
1212

1313
from uwtools.config.validator import _validation_errors
1414
from uwtools.utils.file import resource_path
@@ -61,7 +61,7 @@ def schema_validator(schema_name: str, *args: Any) -> Callable:
6161
:returns: A lambda that, when called with an input to test, returns a string (possibly empty)
6262
containing the validation errors.
6363
"""
64-
schema = yaml.safe_load((resource_path("jsonschema") / f"{schema_name}.jsonschema").read_text())
64+
schema = json.loads((resource_path("jsonschema") / f"{schema_name}.jsonschema").read_text())
6565
defs = schema.get("$defs", {})
6666
for arg in args:
6767
schema = schema[arg]

0 commit comments

Comments
 (0)