diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2db6b99 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: python +python: + - 2.7 + - 3.7 +env: + - FILENAME=test-eslint1 + - FILENAME=test-eslint2 + - FILENAME=test-eslint3 + - FILENAME=test + - FILENAME=test2 + - FILENAME=test3 +install: pip install flake8 junit-xml yamlish +before_script: flake8 . --count --select=E9,F --show-source --statistics +script: + - python -m tap2junit -i test/fixtures/${FILENAME}.tap -o test/output/${FILENAME}.xml + - cat test/output/${FILENAME}.xml diff --git a/Pipfile b/Pipfile index caa5185..ee8f0c9 100644 --- a/Pipfile +++ b/Pipfile @@ -10,4 +10,3 @@ junit-xml = "*" [dev-packages] [requires] -python_version = "2.7" diff --git a/setup.py b/setup.py index 201cb95..20808d6 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # coding: utf-8 # Always prefer setuptools over distutils -from setuptools import setup, find_packages +from setuptools import setup # To use a consistent encoding from codecs import open from os import path @@ -26,6 +26,7 @@ 'Topic :: Software Development :: Build Tools', "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 3', ], keywords='tap13 junit', packages=['tap2junit'], diff --git a/tap2junit/__main__.py b/tap2junit/__main__.py index 4ad236f..04a8e65 100644 --- a/tap2junit/__main__.py +++ b/tap2junit/__main__.py @@ -2,7 +2,7 @@ import os import platform from junit_xml import TestSuite, TestCase -from tap13 import TAP13 as tap13 +from tap2junit.tap13 import TAP13 as tap13 def map_yaml_to_junit(test): @@ -52,4 +52,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/tap2junit/tap13.py b/tap2junit/tap13.py index 0155cfa..df6535b 100644 --- a/tap2junit/tap13.py +++ b/tap2junit/tap13.py @@ -17,10 +17,20 @@ # # Author: Josef Skladanka +from __future__ import print_function + import re +try: + from StringIO import StringIO +except ImportError: + from io import StringIO + import yamlish -import StringIO +try: + basestring +except NameError: + basestring = str RE_VERSION = re.compile(r"^\s*TAP version 13\s*$") @@ -144,8 +154,8 @@ def _parse(self, source): def parse(self, source): - if isinstance(source, (str, unicode)): - self._parse(StringIO.StringIO(source)) + if isinstance(source, basestring): + self._parse(StringIO(source)) elif hasattr(source, "__iter__"): self._parse(source)