Skip to content

Instantly share code, notes, and snippets.

@boblefrag
Created January 5, 2016 15:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save boblefrag/85bf36c458a11b384a31 to your computer and use it in GitHub Desktop.
Save boblefrag/85bf36c458a11b384a31 to your computer and use it in GitHub Desktop.
get the test ordered by time execution for NoseTest
from lxml import etree
tree = etree.parse("<path to nosetests.xml>")
results = []
for t in tree.xpath("/testsuite/testcase"):
result = {"class": t.get('classname'),
"name": t.get('name'),
"time": t.get('time')}
results.append(result)
results = sorted(results, key=lambda k: k['time'], reverse=True)
for result in results:
print "{class}.{name} : {time}".format(**result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment