Skip to content

Python 3 changes plus automated testing #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this not be "2.7,3.7", to reflect what's being used in the Travis config?

Copy link
Collaborator Author

@cclauss cclauss Sep 21, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that leaving it out is in alignment with the docs... https://pipenv-fork.readthedocs.io/en/latest/basics.html#specifying-versions-of-python

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sure :)

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