示例#1
0
    def install_user_vanilla(self,
                             user_vanilla_path,
                             output_path,
                             multi_lang=True):
        """
        """
        if not user_vanilla_path or not len(user_vanilla_path):
            return

        if multi_lang:
            user_vanilla_path = os.path.join(user_vanilla_path,
                                             self.config.language)
        else:
            user_vanilla_path = os.path.join(user_vanilla_path)

        if not os.path.exists(user_vanilla_path):
            Printer.warn(
                "Could not find user vanilla folder at path %s. Ignoring" %
                user_vanilla_path)
            return

        for item in os.listdir(user_vanilla_path):
            s = os.path.join(user_vanilla_path, item)
            d = os.path.join(output_path, item)
            if os.path.isdir(s):
                shutil.copytree(s, d, False, None)
            else:
                shutil.copy2(s, d)
示例#2
0
    def addFailure(self, test, err, connection):
        """ Add failure to the result
        """
        TestResult.addFailure(self, test, err)
        self.tests[self.getDescription(test)] = {"status": "FAILURE", "stacktrace": err, "connection": connection}

        Printer.warn("Failure")
        Printer.warn(err[1])
        TestHelper.trace(connection)
示例#3
0
    def addError(self, test, err, connection=None):
        """ Add error to the result
        """
        TestResult.addError(self, test, err)
        self.tests[self.getDescription(test)] = {"status": "ERROR", "stacktrace": err, "connection": connection}

        Printer.warn("ERROR")
        Printer.warn(err[1])
        TestHelper.trace(connection)
示例#4
0
    def generate_documentation(self):
        """
        """
        name = self.monolithe_config.get_option("name", "transformer")
        output = self.monolithe_config.get_option("output", "transformer")
        doc_output = self.monolithe_config.get_option("doc_output", "transformer")

        input_path = os.path.join(output, self.monolithe_config.language, name)
        output_path = os.path.join(doc_output, self.monolithe_config.language)

        if self.monolithe_config.language == 'python':
            Printer.log("generating documentation...")
            os.system("pdoc --overwrite --html --html-dir '%s' '%s' >/dev/null 2>&1" % (output_path, input_path))
            Printer.success("%s documentation generation complete and available in \"%s\"" % (name, output_path))
        else:
            Printer.warn("no documentation generator for this language. ignoring")
示例#5
0
    def run(self, test):
        """ Run the given test case or test suite.
        """
        result = self._makeResult()
        startTime = time.time()
        test(result)
        stopTime = time.time()
        timeTaken = stopTime - startTime

        run = result.testsRun
        Printer.log("Ran %d test%s in %.3fs" % (run, run != 1 and "s" or "", timeTaken))

        if not result.wasSuccessful():
            Printer.warn("FAILED (failures=%i, errors=%i)" % (len(result.failures), len(result.errors)))
        else:
            Printer.success("OK")
        return result
示例#6
0
    def trace(cls, connection):
        """ Trace connection information

        """
        if not connection:
            return

        request = connection.request
        response = connection.response

        Printer.warn("%s %s [Response %s]" % (request.method, request.url, response.status_code))
        Printer.log("Header")
        Printer.json(request.headers)
        Printer.log("Body")
        Printer.json(request.data)
        Printer.log("Response")
        Printer.json(response.data)
        if len(response.errors):
            Printer.log("Errors")
            Printer.json(response.errors)
示例#7
0
    def trace(cls, connection):
        """ Trace connection information

        """
        if not connection:
            return

        request = connection.request
        response = connection.response

        Printer.warn("%s %s [Response %s]" % (request.method, request.url, response.status_code))
        Printer.log("Header")
        Printer.json(request.headers)
        Printer.log("Body")
        Printer.json(request.data)
        Printer.log("Response")
        Printer.json(response.data)
        if len(response.errors):
            Printer.log("Errors")
            Printer.json(response.errors)
示例#8
0
    def install_user_vanilla(self, user_vanilla_path, output_path, multi_lang=True):
        """
        """
        if not user_vanilla_path or not len(user_vanilla_path):
            return

        if multi_lang:
            user_vanilla_path = os.path.join(user_vanilla_path, self.monolithe_config.language)
        else:
            user_vanilla_path = os.path.join(user_vanilla_path)

        if not os.path.exists(user_vanilla_path):
            Printer.warn("Could not find user vanilla folder at path %s. Ignoring" % user_vanilla_path)
            return

        for item in os.listdir(user_vanilla_path):
            s = os.path.join(user_vanilla_path, item)
            d = os.path.join(output_path, item)
            if os.path.isdir(s):
                shutil.copytree(s, d, False, None)
            else:
                shutil.copy2(s, d)