Esempio n. 1
0
 def setUp(self):
     self.tmpfile = mkstemp()
     self.test_result = xunit.xUnitTestResult()
     self.test_result.filename = self.tmpfile[1]
     self.test_result.start_tests()
     self.test1 = test.Test()
     self.test1.status = 'PASS'
     self.test1.time_elapsed = 1.23
Esempio n. 2
0
 def setUp(self):
     self.tmpfile = mkstemp()
     self.test_result = xunit.xUnitTestResult()
     self.test_result.filename = self.tmpfile[1]
     self.test_result.start_tests()
     self.test1 = test.Test()
     self.test1.status = 'PASS'
     self.test1.time_elapsed = 1.23
Esempio n. 3
0
 def setUp(self):
     self.tmpfile = mkstemp()
     args = argparse.Namespace()
     args.xunit_output = self.tmpfile[1]
     self.test_result = xunit.xUnitTestResult(stream=_Stream(), args=args)
     self.test_result.start_tests()
     self.test1 = test.Test(job=job.Job())
     self.test1.status = 'PASS'
     self.test1.time_elapsed = 1.23
Esempio n. 4
0
 def setUp(self):
     self.tmpfile = mkstemp()
     args = argparse.Namespace()
     args.xunit_output = self.tmpfile[1]
     self.test_result = xunit.xUnitTestResult(stream=_Stream(), args=args)
     self.test_result.start_tests()
     self.test1 = test.Test(job=job.Job())
     self.test1.status = 'PASS'
     self.test1.time_elapsed = 1.23
Esempio n. 5
0
    def _make_test_result(self):
        """
        Set up output plugins.

        The basic idea behind the output plugins is:

        * If there are any active output plugins, use them
        * Always add Xunit and JSON plugins outputting to files inside the
          results dir
        * If at the end we only have 2 output plugins (Xunit and JSON), we can
          add the human output plugin.
        """
        if self.args:
            # If there are any active output plugins, let's use them
            self._set_output_plugins()

        # Setup the xunit plugin to output to the debug directory
        xunit_file = os.path.join(self.logdir, 'results.xml')
        args = argparse.Namespace()
        args.xunit_output = xunit_file
        xunit_plugin = xunit.xUnitTestResult(self.view, args)
        self.result_proxy.add_output_plugin(xunit_plugin)

        # Setup the json plugin to output to the debug directory
        json_file = os.path.join(self.logdir, 'results.json')
        args = argparse.Namespace()
        args.json_output = json_file
        json_plugin = jsonresult.JSONTestResult(self.view, args)
        self.result_proxy.add_output_plugin(json_plugin)

        # Setup the json plugin to output to the debug directory
        if HTML_REPORT_SUPPORT:
            html_file = os.path.join(self.logdir, 'html', 'results.html')
            args = argparse.Namespace()
            args.html_output = html_file
            if self.args is not None:
                args.open_browser = getattr(self.args, 'open_browser')
            else:
                args.open_browser = False
            args.relative_links = True
            html_plugin = htmlresult.HTMLTestResult(self.view, args)
            self.result_proxy.add_output_plugin(html_plugin)

        op_set_stdout = self.result_proxy.output_plugins_using_stdout()
        if len(op_set_stdout) > 1:
            msg = ('Options %s are trying to use stdout simultaneously' %
                   " ".join(op_set_stdout))
            self.view.notify(event='error', msg=msg)
            msg = ('Please set at least one of them to a file to avoid '
                   'conflicts')
            self.view.notify(event='error', msg=msg)
            sys.exit(exit_codes.AVOCADO_JOB_FAIL)

        if not op_set_stdout:
            human_plugin = result.HumanTestResult(self.view, self.args)
            self.result_proxy.add_output_plugin(human_plugin)
Esempio n. 6
0
    def _make_test_result(self):
        """
        Set up output plugins.

        The basic idea behind the output plugins is:

        * If there are any active output plugins, use them
        * Always add Xunit and JSON plugins outputting to files inside the
          results dir
        * If at the end we only have 2 output plugins (Xunit and JSON), we can
          add the human output plugin.
        """
        if self.args:
            # If there are any active output plugins, let's use them
            self._set_output_plugins()

        # Setup the xunit plugin to output to the debug directory
        xunit_file = os.path.join(self.logdir, 'results.xml')
        args = argparse.Namespace()
        args.xunit_output = xunit_file
        xunit_plugin = xunit.xUnitTestResult(self.view, args)
        self.result_proxy.add_output_plugin(xunit_plugin)

        # Setup the json plugin to output to the debug directory
        json_file = os.path.join(self.logdir, 'results.json')
        args = argparse.Namespace()
        args.json_output = json_file
        json_plugin = jsonresult.JSONTestResult(self.view, args)
        self.result_proxy.add_output_plugin(json_plugin)

        # Setup the json plugin to output to the debug directory
        if HTML_REPORT_SUPPORT:
            html_file = os.path.join(self.logdir, 'html', 'results.html')
            args = argparse.Namespace()
            args.html_output = html_file
            if self.args is not None:
                args.open_browser = getattr(self.args, 'open_browser')
            else:
                args.open_browser = False
            args.relative_links = True
            html_plugin = htmlresult.HTMLTestResult(self.view, args)
            self.result_proxy.add_output_plugin(html_plugin)

        op_set_stdout = self.result_proxy.output_plugins_using_stdout()
        if len(op_set_stdout) > 1:
            msg = ('Options %s are trying to use stdout simultaneously' %
                   " ".join(op_set_stdout))
            self.view.notify(event='error', msg=msg)
            msg = ('Please set at least one of them to a file to avoid '
                   'conflicts')
            self.view.notify(event='error', msg=msg)
            sys.exit(exit_codes.AVOCADO_JOB_FAIL)

        if not op_set_stdout and not self.standalone:
            human_plugin = result.HumanTestResult(self.view, self.args)
            self.result_proxy.add_output_plugin(human_plugin)