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
@@ -65,7 +68,7 @@ def test_cwl_inputs_to_jsonschema(tool_path: Path, inputs_path: Path) -> None:
6568 try :
6669 validate (input_obj , json_schema )
6770 except (ValidationError , SchemaError ) as err :
68- _cwlutilslogger .error (
71+ logger .error (
6972 f"Validation failed for { inputs_path .name } "
7073 f"against schema generated for input { tool_path .name } "
7174 )
@@ -79,10 +82,10 @@ def test_cwl_inputs_to_jsonschema_fails() -> None:
7982
8083 cwl_obj = load_document_by_uri (tool_path .as_uri ())
8184
82- _cwlutilslogger .info (f"Generating schema for { tool_path .name } " )
85+ logger .info (f"Generating schema for { tool_path .name } " )
8386 json_schema = cwl_to_jsonschema (cwl_obj )
8487
85- _cwlutilslogger .info (
88+ logger .info (
8689 f"Testing { inputs_path .name } against schema generated for input { tool_path .name } "
8790 )
8891
0 commit comments