Skip to content

Instantly share code, notes, and snippets.

@suside
Created December 12, 2013 08:48

Revisions

  1. suside created this gist Dec 12, 2013.
    19 changes: 19 additions & 0 deletions scent.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    import re
    from subprocess import call

    import requests
    from sniffer.api import runnable


    @runnable
    def execute_tests(*args):
    result = call(str(args[1] + ' --verbosity 2 --nologcapture --stop --with-xunit --xunit-file=/run/shm/test_output.xml').split(' ')) == 0
    file_content = open('/run/shm/test_output.xml', 'r').read()
    for filepath, line in reversed(re.findall('File "(.*)", line ([0-9]+)', file_content)):
    if 'site-packages' not in filepath:
    parts = filepath.split('/')
    le = len(parts)
    url = 'http://10.0.3.1:51235/file?file={}&line={}'.format(parts[le - 2] + '/' + parts[le - 1], line)
    requests.get(url)
    break
    return result