Created
March 21, 2018 08:27
-
-
Save e3krisztian/9e445253004b8100b3bb34e3f6b3a9f7 to your computer and use it in GitHub Desktop.
experimental Junit wrapper for flake8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from xml.etree.ElementTree import ElementTree, XML, tostring as xml_tostring | |
JUNIT_SINGLE_SUCCESS = '''\ | |
<?xml version="1.0" encoding="UTF-8"?> | |
<testsuite tests="1"> | |
<testcase name="Clean code!"/> | |
</testsuite> | |
''' | |
JUNIT_SINGLE_FAILURE = '''\ | |
<?xml version="1.0" encoding="UTF-8"?> | |
<testsuite tests="1"> | |
<testcase name="Code smells"> | |
<failure type="flake8"> details about failure </failure> | |
</testcase> | |
</testsuite> | |
''' | |
xml = ElementTree(XML(JUNIT_SINGLE_FAILURE)) | |
e = xml.find('testcase/failure') | |
# print(e) | |
# e.set('type', 'flake8') | |
e.text = 'Eror: 1 < 2' | |
xml.write(sys.stdout, encoding='utf-8', xml_declaration=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment