Skip to content

Commit

Permalink
Python 3 changes plus automated testing
Browse files Browse the repository at this point in the history
PR-URL: #5
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Matt (IPv4) Cowley <me@mattcowley.co.uk>
  • Loading branch information
cclauss committed Sep 24, 2019
1 parent 6b20e15 commit ee5c20b
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
16 changes: 16 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ junit-xml = "*"
[dev-packages]

[requires]
python_version = "2.7"
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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'],
Expand Down
4 changes: 2 additions & 2 deletions tap2junit/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -52,4 +52,4 @@ def main():


if __name__ == "__main__":
main()
main()
16 changes: 13 additions & 3 deletions tap2junit/tap13.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@
#
# Author: Josef Skladanka <jskladan@redhat.com>

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*$")
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit ee5c20b

Please sign in to comment.