From ba52fe6a71a088a031a9020d2e755b456fb65524 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Thu, 20 Feb 2020 17:00:25 -0500 Subject: [PATCH] Try to work around windows path issues --- cwltest/__init__.py | 7 ++++++- cwltest/tests/test_categories.py | 10 +++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/cwltest/__init__.py b/cwltest/__init__.py index a1444b9..a2282e8 100755 --- a/cwltest/__init__.py +++ b/cwltest/__init__.py @@ -17,6 +17,7 @@ import ruamel.yaml.scanner as yamlscanner import schema_salad.ref_resolver import schema_salad.schema +import schema_salad.avro.schema import pkg_resources # part of setuptools import junit_xml @@ -355,12 +356,16 @@ def main(): # type: () -> int return 1 schema_resource = pkg_resources.resource_stream(__name__, "cwltest-schema.yml") - cache = {"https://w3id.org/cwl/cwltest/cwltest-schema.yml": schema_resource.read()} + cache = {"https://w3id.org/cwl/cwltest/cwltest-schema.yml": schema_resource.read().decode("utf-8")} (document_loader, avsc_names, schema_metadata, metaschema_loader) = schema_salad.schema.load_schema("https://w3id.org/cwl/cwltest/cwltest-schema.yml", cache=cache) + if not isinstance(avsc_names, schema_salad.avro.schema.Names): + print(avsc_names) + return 1 + tests, metadata = schema_salad.schema.load_and_validate(document_loader, avsc_names, args.test, True) failures = 0 diff --git a/cwltest/tests/test_categories.py b/cwltest/tests/test_categories.py index e76c080..3ec6719 100644 --- a/cwltest/tests/test_categories.py +++ b/cwltest/tests/test_categories.py @@ -6,13 +6,13 @@ from .util import run_with_mock_cwl_runner, get_data import xml.etree.ElementTree as ET - +import schema_salad.ref_resolver class TestCategories(unittest.TestCase): maxDiff = None def test_unsupported_with_required_tests(self): - args = ["--test", get_data("tests/test-data/required-unsupported.yml")] + args = ["--test", schema_salad.ref_resolver.file_uri(get_data("tests/test-data/required-unsupported.yml"))] try: cwd = os.getcwd() os.chdir(get_data("tests/test-data/")) @@ -47,7 +47,7 @@ def test_unsupported_with_required_tests(self): ) def test_unsupported_with_optional_tests(self): - args = ["--test", get_data("tests/test-data/optional-unsupported.yml")] + args = ["--test", schema_salad.ref_resolver.file_uri(get_data("tests/test-data/optional-unsupported.yml"))] error_code, stdout, stderr = run_with_mock_cwl_runner(args) self.assertEqual(error_code, 0) self.assertEqual( @@ -58,7 +58,7 @@ def test_unsupported_with_optional_tests(self): ) def test_error_with_optional_tests(self): - args = ["--test", get_data("tests/test-data/optional-error.yml")] + args = ["--test", schema_salad.ref_resolver.file_uri(get_data("tests/test-data/optional-error.yml"))] error_code, stdout, stderr = run_with_mock_cwl_runner(args) self.assertEqual(error_code, 1) self.assertIn("1 failures", stderr) @@ -67,7 +67,7 @@ def test_category_in_junit_xml(self): junit_xml_report = get_data("tests/test-data/junit-report.xml") args = [ "--test", - get_data("tests/test-data/optional-error.yml"), + schema_salad.ref_resolver.file_uri(get_data("tests/test-data/optional-error.yml")), "--junit-xml", junit_xml_report, ]