Skip to content

Commit ee5c20b

Browse files
committed
Python 3 changes plus automated testing
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>
1 parent 6b20e15 commit ee5c20b

File tree

5 files changed

+33
-7
lines changed

5 files changed

+33
-7
lines changed

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
language: python
2+
python:
3+
- 2.7
4+
- 3.7
5+
env:
6+
- FILENAME=test-eslint1
7+
- FILENAME=test-eslint2
8+
- FILENAME=test-eslint3
9+
- FILENAME=test
10+
- FILENAME=test2
11+
- FILENAME=test3
12+
install: pip install flake8 junit-xml yamlish
13+
before_script: flake8 . --count --select=E9,F --show-source --statistics
14+
script:
15+
- python -m tap2junit -i test/fixtures/${FILENAME}.tap -o test/output/${FILENAME}.xml
16+
- cat test/output/${FILENAME}.xml

Pipfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ junit-xml = "*"
1010
[dev-packages]
1111

1212
[requires]
13-
python_version = "2.7"

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# coding: utf-8
22

33
# Always prefer setuptools over distutils
4-
from setuptools import setup, find_packages
4+
from setuptools import setup
55
# To use a consistent encoding
66
from codecs import open
77
from os import path
@@ -26,6 +26,7 @@
2626
'Topic :: Software Development :: Build Tools',
2727
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
2828
'Programming Language :: Python :: 2',
29+
'Programming Language :: Python :: 3',
2930
],
3031
keywords='tap13 junit',
3132
packages=['tap2junit'],

tap2junit/__main__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import platform
44
from junit_xml import TestSuite, TestCase
5-
from tap13 import TAP13 as tap13
5+
from tap2junit.tap13 import TAP13 as tap13
66

77

88
def map_yaml_to_junit(test):
@@ -52,4 +52,4 @@ def main():
5252

5353

5454
if __name__ == "__main__":
55-
main()
55+
main()

tap2junit/tap13.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,20 @@
1717
#
1818
# Author: Josef Skladanka <jskladan@redhat.com>
1919

20+
from __future__ import print_function
21+
2022
import re
23+
try:
24+
from StringIO import StringIO
25+
except ImportError:
26+
from io import StringIO
27+
2128
import yamlish
22-
import StringIO
2329

30+
try:
31+
basestring
32+
except NameError:
33+
basestring = str
2434

2535

2636
RE_VERSION = re.compile(r"^\s*TAP version 13\s*$")
@@ -144,8 +154,8 @@ def _parse(self, source):
144154

145155

146156
def parse(self, source):
147-
if isinstance(source, (str, unicode)):
148-
self._parse(StringIO.StringIO(source))
157+
if isinstance(source, basestring):
158+
self._parse(StringIO(source))
149159
elif hasattr(source, "__iter__"):
150160
self._parse(source)
151161

0 commit comments

Comments
 (0)