Skip to content

Instantly share code, notes, and snippets.

@chadwhitacre
Created December 8, 2012 03:26
Show Gist options
  • Save chadwhitacre/4238447 to your computer and use it in GitHub Desktop.
Save chadwhitacre/4238447 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python -u
import commands
import os
import random
import sys
import time
restart = '-s' in sys.argv
if restart:
sys.argv.remove('-s')
try:
nreps = int(sys.argv[1])
except IndexError:
nreps = 4
if restart:
os.system('cd /Library/PostgreSQL/9.1/ && sudo -u postgres pg_ctl restart -D data')
for i in range(nreps):
time.sleep(2 * random.random())
output = commands.getoutput('swaddle env ./nosetests test_participant.py')
if 'FAILED' in output:
assert 'two_dollars' in output, output
sys.stdout.write('X')
else:
assert 'OK' in output, output
sys.stdout.write('.')
print
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment