11# SPDX-License-Identifier: Apache-2.0
22"""Tests for cwl-inputs-schema-gen."""
3+ import logging
34from pathlib import Path
45
56import pytest
89from ruamel .yaml import YAML
910
1011from cwl_utils .inputs_schema_gen import cwl_to_jsonschema
11- from cwl_utils .loghandler import _logger as _cwlutilslogger
1212from cwl_utils .parser import load_document_by_uri
1313
1414from .util import get_path
1515
16+ logging .basicConfig (level = logging .DEBUG )
17+ logger = logging .getLogger ()
18+
1619TEST_PARAMS = [
1720 # Packed Case
1821 (
5154def test_cwl_inputs_to_jsonschema (tool_path : Path , inputs_path : Path ) -> None :
5255 cwl_obj = load_document_by_uri (tool_path .as_uri ())
5356
54- _cwlutilslogger .info (f"Generating schema for { tool_path .name } " )
57+ logger .info (f"Generating schema for { tool_path .name } " )
5558 json_schema = cwl_to_jsonschema (cwl_obj )
5659
57- _cwlutilslogger .info (
60+ logger .info (
5861 f"Testing { inputs_path .name } against schema generated for input { tool_path .name } "
5962 )
6063
@@ -63,7 +66,7 @@ def test_cwl_inputs_to_jsonschema(tool_path: Path, inputs_path: Path) -> None:
6366 try :
6467 validate (input_obj , json_schema )
6568 except (ValidationError , SchemaError ) as err :
66- _cwlutilslogger .error (
69+ logger .error (
6770 f"Validation failed for { inputs_path .name } "
6871 f"against schema generated for input { tool_path .name } "
6972 )
@@ -77,10 +80,10 @@ def test_cwl_inputs_to_jsonschema_fails() -> None:
7780
7881 cwl_obj = load_document_by_uri (tool_path .as_uri ())
7982
80- _cwlutilslogger .info (f"Generating schema for { tool_path .name } " )
83+ logger .info (f"Generating schema for { tool_path .name } " )
8184 json_schema = cwl_to_jsonschema (cwl_obj )
8285
83- _cwlutilslogger .info (
86+ logger .info (
8487 f"Testing { inputs_path .name } against schema generated for input { tool_path .name } "
8588 )
8689
0 commit comments