Пример #1
0
    def run_server(self):
        'this method blocks, so run it in a separate thread'
        cmdArgs = (sys.executable, self.server_script) + tuple(sys.argv) \
                  + ('--port-file=' + self.port_file,
                     '--pygrdatapath=' + self.pygrDataPath,
                     '--downloadDB=' + self.downloadDB,
                     '--resources=' + ':'.join(self.pygrDataNames))
        if self.port:  # only add port argument if set
            cmdArgs += ('--port=' + str(self.port), )
        p = classutil.FilePopen(cmdArgs,
                                stdout=classutil.PIPE,
                                stderr=classutil.PIPE)
        try:
            logger.debug('Starting XML-RPC server: ')
            logger.debug(repr(cmdArgs))
            if p.wait():
                logger.warn('XML-RPC server command failed!')
            output = p.stdout.read()
            errout = p.stderr.read()
            logger.debug('XML-RPC server output: %s' % output)
            logger.debug('XML-RPC server error out: %s' % errout)
        finally:
            p.close()

        logger.debug('server stopped')
Пример #2
0
def check_results(results, correct, formatter, delta=0.01, reformatCorrect=False, reformatResults=True):
    if reformatResults:
        results = reformat_results(results, formatter)

    if reformatCorrect:  # reformat these data too
        correct = reformat_results(correct, formatter)
    else:
        correct.sort()

    # this is to help troubleshooting the mismatches if there are any
    mismatch = [(a, b) for a, b in zip(correct, results) if testutil.approximate_cmp([a], [b], delta)]
    if mismatch:
        logger.warn("blast mismatches found")
        for m in mismatch:
            logger.warn("%s != %s" % m)

    # this is the actual test
    assert testutil.approximate_cmp(correct, results, delta) == 0
Пример #3
0
def check_results(results, correct, formatter, delta=0.01):
    found = []
    for result in results:
        for t in result.edges():
            found.append(formatter(t))

    # order it identically
    correct.sort()
    found.sort()

    # this is to help troubleshooting the mismatches if there are any
    mismatch = [ (a, b) for a, b in zip(correct, found) if
                 testutil.approximate_cmp([a], [b], delta)]
    if mismatch:
        logger.warn('blast mismatches found')
        for m in mismatch:
            logger.warn('%s != %s' % m)

    # this is the actual test
    assert testutil.approximate_cmp(correct, found, delta) == 0
Пример #4
0
    def run_server(self):
        'this method blocks, so run it in a separate thread'
        cmdArgs = (sys.executable, self.server_script) + tuple(sys.argv) \
                  + ('--port=' + str(self.port),
                     '--port-file=' + self.port_file,
                     '--pygrdatapath=' + self.pygrDataPath,
                     '--downloadDB=' + self.downloadDB,
                     '--resources=' + ':'.join(self.pygrDataNames))
        p = classutil.FilePopen(cmdArgs, stdout=classutil.PIPE,
                                stderr=classutil.PIPE)
        try:
            logger.debug('Starting XML-RPC server: ')
            logger.debug(repr(cmdArgs))
            if p.wait():
                logger.warn('XML-RPC server command failed!')
            output = p.stdout.read()
            errout = p.stderr.read()
            logger.debug('XML-RPC server output: %s' % output)
            logger.debug('XML-RPC server error out: %s' % errout)
        finally:
            p.close()

        logger.debug('server stopped')