Skip to content

Commit

Permalink
check_test_ran.py: remove grep/xsltproc (#203)
Browse files Browse the repository at this point in the history
We aren't using QTest anymore in ign-gui, so remove
the parts of check_test_ran.py that translated QTest
xml files into junit, since they don't work easily
on Windows and aren't needed any longer.

Fixes #198.

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Apr 5, 2021
1 parent 01cc9e0 commit 064f815
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions tools/check_test_ran.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

import os
import sys
import subprocess

def usage():
print("""Usage:
Expand All @@ -53,29 +52,6 @@ def usage():
print(sys.argv)
sys.exit(getattr(os, 'EX_USAGE', 1))

def run_grep(filename, arg):
process = subprocess.Popen(['grep', arg, filename], stdout=subprocess.PIPE)
stdout, stderr = process.communicate()
return stdout, stderr

def run_xsltproc(stylesheet, document):
try:
process = subprocess.Popen(['xsltproc', stylesheet, document], stdout=subprocess.PIPE)
stdout, stderr = process.communicate()
# Overwrite same document
open(document, 'w').write(stdout)
except OSError as err:
test_name = os.path.basename(document)
f = open(document, 'w')
d = {'test': test_name, 'test_file': document, 'test_no_xml': test_name.replace('.xml', '')}
f.write("""<?xml version="1.0" encoding="UTF-8"?>
<testsuite tests="1" failures="1" time="1" errors="0" name="%(test)s">
<testcase name="test_ran" status="run" time="1" classname="%(test_no_xml)s">
<failure message="Unable to find xsltproc. Can not parse output test for QTest suite." type=""/>
</testcase>
</testsuite>"""%d)
sys.exit(getattr(os, 'EX_USAGE', 1))

def check_main():
if len(sys.argv) < 2:
usage()
Expand All @@ -98,14 +74,6 @@ def check_main():
<failure message="Unable to find test results for %(test)s, test did not run.\nExpected results in %(test_file)s" type=""/>
</testcase>
</testsuite>"""%d)
sys.exit(getattr(os, 'EX_USAGE', 1))

# Checking if test is a QTest file
stdout, stderr = run_grep(test_file, "QtVersion")
if (stdout):
print("Detect QTest xml file. Converting to JUNIT ...")
stylesheet = os.path.dirname(os.path.abspath(__file__)) + "/qtest_to_junit.xslt"
run_xsltproc(stylesheet, test_file)

if __name__ == '__main__':
check_main()

0 comments on commit 064f815

Please sign in to comment.