1
1
# SPDX-License-Identifier: Apache-2.0
2
2
"""Tests for cwl-inputs-schema-gen."""
3
+ import logging
3
4
from pathlib import Path
4
5
5
6
import pytest
8
9
from ruamel .yaml import YAML
9
10
10
11
from cwl_utils .inputs_schema_gen import cwl_to_jsonschema
11
- from cwl_utils .loghandler import _logger as _cwlutilslogger
12
12
from cwl_utils .parser import load_document_by_uri
13
13
14
14
from .util import get_path
15
15
16
+ logging .basicConfig (level = logging .DEBUG )
17
+ logger = logging .getLogger ()
18
+
16
19
TEST_PARAMS = [
17
20
# Packed Case
18
21
(
51
54
def test_cwl_inputs_to_jsonschema (tool_path : Path , inputs_path : Path ) -> None :
52
55
cwl_obj = load_document_by_uri (tool_path .as_uri ())
53
56
54
- _cwlutilslogger .info (f"Generating schema for { tool_path .name } " )
57
+ logger .info (f"Generating schema for { tool_path .name } " )
55
58
json_schema = cwl_to_jsonschema (cwl_obj )
56
59
57
- _cwlutilslogger .info (
60
+ logger .info (
58
61
f"Testing { inputs_path .name } against schema generated for input { tool_path .name } "
59
62
)
60
63
@@ -65,7 +68,7 @@ def test_cwl_inputs_to_jsonschema(tool_path: Path, inputs_path: Path) -> None:
65
68
try :
66
69
validate (input_obj , json_schema )
67
70
except (ValidationError , SchemaError ) as err :
68
- _cwlutilslogger .error (
71
+ logger .error (
69
72
f"Validation failed for { inputs_path .name } "
70
73
f"against schema generated for input { tool_path .name } "
71
74
)
@@ -79,10 +82,10 @@ def test_cwl_inputs_to_jsonschema_fails() -> None:
79
82
80
83
cwl_obj = load_document_by_uri (tool_path .as_uri ())
81
84
82
- _cwlutilslogger .info (f"Generating schema for { tool_path .name } " )
85
+ logger .info (f"Generating schema for { tool_path .name } " )
83
86
json_schema = cwl_to_jsonschema (cwl_obj )
84
87
85
- _cwlutilslogger .info (
88
+ logger .info (
86
89
f"Testing { inputs_path .name } against schema generated for input { tool_path .name } "
87
90
)
88
91
0 commit comments