Skip to content

Commit b06e5ac

Browse files
authored
Merge pull request #512 from common-workflow-language/rdf_python3_fix
cwltool/cwlrdf.py: Pass str rather than bytes to write function (Python 3 fix)
2 parents 781ace4 + efc94d7 commit b06e5ac

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

cwltool/cwlrdf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ def visitor(t):
2020
return g
2121

2222

23-
def printrdf(wf, ctx, sr, stdout):
24-
# type: (Process, ContextType, Text, IO[Any]) -> None
25-
stdout.write(gather(wf, ctx).serialize(format=sr))
23+
def printrdf(wf, ctx, sr):
24+
# type: (Process, ContextType, Text) -> Text
25+
return gather(wf, ctx).serialize(format=sr).decode('utf-8')
2626

2727

2828
def lastpart(uri): # type: (Any) -> Text

cwltool/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ def main(argsl=None, # type: List[str]
839839
return 0
840840

841841
if args.print_rdf:
842-
printrdf(tool, document_loader.ctx, args.rdf_serializer, stdout)
842+
stdout.write(printrdf(tool, document_loader.ctx, args.rdf_serializer))
843843
return 0
844844

845845
if args.print_dot:

tests/test_rdfprint.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from __future__ import absolute_import
2+
import unittest
3+
4+
from six import StringIO
5+
from cwltool.main import main
6+
7+
from .util import get_data
8+
9+
class RDF_Print(unittest.TestCase):
10+
11+
def test_rdf_print(self):
12+
self.assertEquals(main(['--print-rdf', get_data('tests/wf/hello_single_tool.cwl')]), 0)

0 commit comments

Comments
 (0)