From 953553a93bb88ae77177bbbfaec845861142d6ec Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Fri, 13 Oct 2023 14:25:02 +0200 Subject: [PATCH] silence spurious warning when validating some documents with "cwltool" extensions --- cwltool/extensions-v1.1.yml | 1 + cwltool/extensions-v1.2.yml | 1 + cwltool/loghandler.py | 2 ++ tests/test_ext.py | 27 +++++++++++++++++---------- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/cwltool/extensions-v1.1.yml b/cwltool/extensions-v1.1.yml index 603c40f05..b901402e9 100644 --- a/cwltool/extensions-v1.1.yml +++ b/cwltool/extensions-v1.1.yml @@ -1,6 +1,7 @@ $base: http://commonwl.org/cwltool# $namespaces: cwl: "https://w3id.org/cwl/cwl#" + cwltool: "http://commonwl.org/cwltool#" $graph: - $import: https://w3id.org/cwl/CommonWorkflowLanguage.yml diff --git a/cwltool/extensions-v1.2.yml b/cwltool/extensions-v1.2.yml index d7fef1160..b2ecf5614 100644 --- a/cwltool/extensions-v1.2.yml +++ b/cwltool/extensions-v1.2.yml @@ -1,6 +1,7 @@ $base: http://commonwl.org/cwltool# $namespaces: cwl: "https://w3id.org/cwl/cwl#" + cwltool: "http://commonwl.org/cwltool#" $graph: - $import: https://w3id.org/cwl/CommonWorkflowLanguage.yml diff --git a/cwltool/loghandler.py b/cwltool/loghandler.py index f8d27e292..0d613c820 100644 --- a/cwltool/loghandler.py +++ b/cwltool/loghandler.py @@ -23,6 +23,8 @@ def configure_logging( rdflib_logger.setLevel(logging.ERROR) deps_logger = logging.getLogger("galaxy.tool_util.deps") deps_logger.addHandler(stderr_handler) + ss_logger = logging.getLogger("salad") + ss_logger.addHandler(stderr_handler) if quiet: # Silence STDERR, not an eventual provenance log file stderr_handler.setLevel(logging.WARN) diff --git a/tests/test_ext.py b/tests/test_ext.py index ffda59c5e..0d2665ca1 100644 --- a/tests/test_ext.py +++ b/tests/test_ext.py @@ -8,13 +8,16 @@ import cwltool.process from cwltool.main import main -from .util import get_data, needs_docker +from .util import get_data, get_main_output, needs_docker @needs_docker def test_missing_enable_ext() -> None: - # Require that --enable-ext is provided. - assert main([get_data("tests/wf/listing_deep.cwl"), get_data("tests/listing-job.yml")]) != 0 + """Require that --enable-ext is provided.""" + error_code, _, _ = get_main_output( + [get_data("tests/wf/listing_deep.cwl"), get_data("tests/listing-job.yml")] + ) + assert error_code != 0 @needs_docker @@ -67,13 +70,6 @@ def test_listing_v1_0() -> None: assert main([get_data("tests/wf/listing_v1_0.cwl"), get_data("tests/listing-job.yml")]) == 0 -@pytest.mark.skip(reason="This is not the default behaviour yet") -@needs_docker -def test_listing_v1_1() -> None: - # Default behavior in 1.1 will be no expansion - assert main([get_data("tests/wf/listing_v1_1.cwl"), get_data("tests/listing-job.yml")]) != 0 - - @needs_docker def test_double_overwrite(tmp_path: Path) -> None: """Test that overwriting an input using cwltool:InplaceUpdateRequirement works.""" @@ -278,3 +274,14 @@ def test_warn_large_inputs() -> None: ) finally: cwltool.process.FILE_COUNT_WARNING = was + + +def test_ext_validation_no_namespace_warning() -> None: + error_code, stdout, stderr = get_main_output( + ["--validate", "--enable-ext", get_data("tests/wf/mpi_env.cwl")] + ) + assert error_code == 0 + assert ( + "URI prefix 'cwltool' of 'cwltool:loop' not recognized, are you " + "missing a $namespaces section?" + ) not in stderr