From d930d5c4c1bdb1881748d3d1a9febaeb412dfdbd Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 28 Feb 2019 14:21:11 +0200 Subject: [PATCH 1/3] start of a workaround for Py2 emoji issues --- cwltest/utils.py | 13 +++++++++++-- setup.py | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/cwltest/utils.py b/cwltest/utils.py index 2c78b14..6720ddc 100644 --- a/cwltest/utils.py +++ b/cwltest/utils.py @@ -1,12 +1,20 @@ import json +from six import PY2 from six.moves import range -from typing import Any, Dict, Set, Text, List, Optional +from typing import Any, AnyStr, Dict, Set, Text, List, Optional import junit_xml REQUIRED = "required" +def clean_output(output): # type: (Text) -> Text + if PY2: + # TODO: find a better and more general fix + return output.replace(u'\U0001f57a', '_') + else: + return output + class TestResult(object): """Encapsulate relevant test result data.""" @@ -30,7 +38,8 @@ def create_test_case(self, test): short_name = test.get(u'short_name') case = junit_xml.TestCase( doc, elapsed_sec=self.duration, file=short_name, - category=category, stdout=self.standard_output, stderr=self.error_output, + category=category, stdout=clean_output(self.standard_output), + stderr=self.error_output, ) if self.return_code > 0: case.failure_message = self.message diff --git a/setup.py b/setup.py index c0443c0..74b5c88 100755 --- a/setup.py +++ b/setup.py @@ -29,6 +29,7 @@ version='1.0', description='Common workflow language testing framework', long_description=open(README).read(), + long_description_content_type="text/x-rst", author='Common workflow language working group', author_email='common-workflow-language@googlegroups.com', url="https://github.com/common-workflow-language/cwltest", From 3d6fddd5a2e58ed9a5ea7c29959eb87fcee451cc Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 28 Feb 2019 15:09:02 +0200 Subject: [PATCH 2/3] generalized fix --- cwltest/utils.py | 8 +++++--- setup.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cwltest/utils.py b/cwltest/utils.py index 6720ddc..363dda8 100644 --- a/cwltest/utils.py +++ b/cwltest/utils.py @@ -2,16 +2,18 @@ from six import PY2 from six.moves import range -from typing import Any, AnyStr, Dict, Set, Text, List, Optional +from typing import Any, Dict, Set, Text, List, Optional import junit_xml +if PY2: + from emoji.core import demojize + REQUIRED = "required" def clean_output(output): # type: (Text) -> Text if PY2: - # TODO: find a better and more general fix - return output.replace(u'\U0001f57a', '_') + return demojize(output) else: return output diff --git a/setup.py b/setup.py index 74b5c88..baae97f 100755 --- a/setup.py +++ b/setup.py @@ -50,6 +50,6 @@ cmdclass={'egg_info': tagger}, python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4', extras_require={':python_version<"3"': [ - 'futures >= 3.0.5', 'subprocess32 >= 3.5.0'], + 'futures >= 3.0.5', 'subprocess32 >= 3.5.0', 'emoji'], ':python_version<"3.5"': ['typing >= 3.5.2'] } ) From 1924c384a262dc4501418e93475927a6b2746882 Mon Sep 17 00:00:00 2001 From: "Michael R. Crusoe" Date: Thu, 28 Feb 2019 15:17:54 +0200 Subject: [PATCH 3/3] add missing types --- typeshed/2.7/emoji/__init__.pyi | 17 +++++++++++++++++ typeshed/2.7/emoji/core.pyi | 11 +++++++++++ typeshed/2.7/emoji/unicode_codes.pyi | 10 ++++++++++ 3 files changed, 38 insertions(+) create mode 100644 typeshed/2.7/emoji/__init__.pyi create mode 100644 typeshed/2.7/emoji/core.pyi create mode 100644 typeshed/2.7/emoji/unicode_codes.pyi diff --git a/typeshed/2.7/emoji/__init__.pyi b/typeshed/2.7/emoji/__init__.pyi new file mode 100644 index 0000000..688e099 --- /dev/null +++ b/typeshed/2.7/emoji/__init__.pyi @@ -0,0 +1,17 @@ +# Stubs for emoji (Python 2) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from emoji.core import emojize +from emoji.core import demojize +from emoji.core import get_emoji_regexp +from emoji.unicode_codes import EMOJI_ALIAS_UNICODE +from emoji.unicode_codes import EMOJI_UNICODE +from emoji.unicode_codes import UNICODE_EMOJI +from emoji.unicode_codes import UNICODE_EMOJI_ALIAS + +__email__: str +__source__: str +__license__: str + + diff --git a/typeshed/2.7/emoji/core.pyi b/typeshed/2.7/emoji/core.pyi new file mode 100644 index 0000000..b376f5f --- /dev/null +++ b/typeshed/2.7/emoji/core.pyi @@ -0,0 +1,11 @@ +# Stubs for emoji.core (Python 3) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any, Text + +def emojize(string: Text, use_aliases: bool = ..., delimiters: Any = ...): ... +def demojize(string: Text, delimiters: Any = ...): ... +def get_emoji_regexp(): ... +def emoji_lis(string: Any): ... + diff --git a/typeshed/2.7/emoji/unicode_codes.pyi b/typeshed/2.7/emoji/unicode_codes.pyi new file mode 100644 index 0000000..2d5cd1c --- /dev/null +++ b/typeshed/2.7/emoji/unicode_codes.pyi @@ -0,0 +1,10 @@ +# Stubs for emoji.unicode_codes (Python 3) +# +# NOTE: This dynamically typed stub was automatically generated by stubgen. + +from typing import Any + +EMOJI_UNICODE: Any +EMOJI_ALIAS_UNICODE: Any +UNICODE_EMOJI: Any +UNICODE_EMOJI_ALIAS: Any