Skip to content

Instantly share code, notes, and snippets.

@suside
Created December 12, 2013 08:48
Show Gist options
  • Save suside/7924982 to your computer and use it in GitHub Desktop.
Save suside/7924982 to your computer and use it in GitHub Desktop.
sniffer scent.py + django + remote eclipse auto open
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment