Skip to content

Commit

Permalink
Merge pull request #92 from common-workflow-language/emoij_workaround
Browse files Browse the repository at this point in the history
Workaround for Py2 emoji issues
  • Loading branch information
mr-c authored Feb 28, 2019
2 parents 7352fed + 1924c38 commit cf7239f
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 2 deletions.
13 changes: 12 additions & 1 deletion cwltest/utils.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
import json

from six import PY2
from six.moves import range
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:
return demojize(output)
else:
return output

class TestResult(object):

"""Encapsulate relevant test result data."""
Expand All @@ -30,7 +40,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
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -49,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'] }
)
17 changes: 17 additions & 0 deletions typeshed/2.7/emoji/__init__.pyi
Original file line number Diff line number Diff line change
@@ -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


11 changes: 11 additions & 0 deletions typeshed/2.7/emoji/core.pyi
Original file line number Diff line number Diff line change
@@ -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): ...

10 changes: 10 additions & 0 deletions typeshed/2.7/emoji/unicode_codes.pyi
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit cf7239f

Please sign in to comment.