client_tests.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:bandit-http-server 作者: evancasey 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号