Skip to content

Commit

Permalink
Merge df8e613 into fc09939
Browse files Browse the repository at this point in the history
  • Loading branch information
markotibold committed Mar 27, 2015
2 parents fc09939 + df8e613 commit 5da4f63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ install:
script:
- tox
env:
- TOXENV=py26
- TOXENV=py27
- TOXENV=py34
after_success:
Expand Down
9 changes: 7 additions & 2 deletions junit_conversor/__init__.py
@@ -1,4 +1,5 @@
import xml.etree.cElementTree as ET
import sys
from collections import defaultdict


Expand Down Expand Up @@ -43,7 +44,11 @@ def _convert(origin, destination):
for error in errors:
ET.SubElement(testcase, "failure", file=error['file'], line=error['line'], col=error['col'],
message=error['detail'], type="flake8 %s" % error['code']) \
.text = "{}:{} {}".format(error['line'], error['col'], error['detail'])
.text = "{0}:{1} {2}".format(error['line'], error['col'], error['detail'])

tree = ET.ElementTree(testsuite)
tree.write(destination, encoding='utf-8', xml_declaration=True)
if (2, 6) == sys.version_info[:2]: # py26
tree.write(destination, encoding='utf-8')
else:
tree.write(destination, encoding='utf-8', xml_declaration=True)

4 changes: 2 additions & 2 deletions tests/tests.py
Expand Up @@ -94,13 +94,13 @@ def test_should_fail_if_source_file_is_not_given(self):
result = self.runner.invoke(conversion, [])

self.assertEqual(2, result.exit_code)
self.assertIn('Missing argument "source"', result.output)
self.assertTrue('Missing argument "source"' in result.output)

def test_should_fail_if_destination_file_is_not_given(self):
result = self.runner.invoke(conversion, [failed_flake8])

self.assertEqual(2, result.exit_code)
self.assertIn('Missing argument "destination', result.output)
self.assertTrue('Missing argument "destination' in result.output)

def test_should_make_a_simple_conversion(self):
with self.runner.isolated_filesystem():
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
@@ -1,6 +1,6 @@
[tox]
skipsdist=True
envlist=py27,py34
envlist=py27,py27,py34

[testenv]
deps=-rrequirements_dev.txt
Expand Down

0 comments on commit 5da4f63

Please sign in to comment.