def setUpClass(self):
# run main.py with args: --test, and wait for it to terminate
cmd = ["python", "../main.py", "--test"]
self.p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=os.setsid)
time.sleep(2)
# if not running, check for errors
if self.p.poll() != None:
output, errors = self.p.communicate()
if self.p.returncode:
print self.p.returncode
sys.exit(errors)
else:
print output
# set the python wrapper to client
self.client = BanditClient()
sys.path.insert(0, '../')
from database import get_test_db
# connect to the test db
self.db = get_test_db()
self.db.flushdb()
评论列表
文章目录