Skip to content

Commit

Permalink
Try to work around windows path issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tetron committed Feb 20, 2020
1 parent 9a229f5 commit ba52fe6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion cwltest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions cwltest/tests/test_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/"))
Expand Down Expand Up @@ -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(
Expand All @@ -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)
Expand All @@ -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,
]
Expand Down

0 comments on commit ba52fe6

Please sign in to comment.