def run_verify(qlogger, msg_type, roles): qlogger.srvr_log(logging.INFO, "beginning run_verify") outdir = None cwd = os.getcwd() strio = StringIO.StringIO() try: root_path = os.path.dirname(cs_pkg_file) outdir = Utils.mkdtemp(prefix="verify_") if os.path.exists(root_path): root_path = os.path.split(root_path)[0] os.chdir(root_path) # otherwise we are running inside a packaged folder and resources are availale at cwd from circuitscape.verify import cs_verifyall testResult = cs_verifyall(out_path=outdir, ext_logger=qlogger, stream=strio) testsPassed = testResult.wasSuccessful() except Exception as e: qlogger.clnt_log("Unexpected error during verify.") qlogger.srvr_log(logging.WARNING, "Exception during verify: " + str(e)) testsPassed = False finally: os.chdir(cwd) Utils.rmdir(outdir) qlogger.clnt_log(strio.getvalue()) strio.close() qlogger.srvr_log(logging.INFO, "end run_verify") qlogger.send_result_msg(msg_type, {'complete': True, 'success': testsPassed})
#!/usr/bin/python ## ## Circuitscape (C) 2013, Brad McRae, Viral B. Shah. and Tanmay Mohapatra from circuitscape.verify import cs_verifyall import sys if __name__ == '__main__': out_path = None root_path = 'circuitscape' if len(sys.argv) > 1: if len(sys.argv) == 3: out_path = sys.argv.pop() elif len(sys.argv) > 3: raise RuntimeError("invalid number of options") root_path = sys.argv.pop() cs_verifyall(root_path, out_path)