Skip to content

Commit 9b569de

Browse files
committed
tests: improve logging
1 parent e413f9b commit 9b569de

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/test_inputs_schema_gen.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22
"""Tests for cwl-inputs-schema-gen."""
3+
import logging
34
from pathlib import Path
45

56
import pytest
@@ -8,11 +9,13 @@
89
from ruamel.yaml import YAML
910

1011
from cwl_utils.inputs_schema_gen import cwl_to_jsonschema
11-
from cwl_utils.loghandler import _logger as _cwlutilslogger
1212
from cwl_utils.parser import load_document_by_uri
1313

1414
from .util import get_path
1515

16+
logging.basicConfig(level=logging.DEBUG)
17+
logger = logging.getLogger()
18+
1619
TEST_PARAMS = [
1720
# Packed Case
1821
(
@@ -51,10 +54,10 @@
5154
def 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

Comments
 (0)