Пример #1
0
 def test_compare_benchmark_results(self):
     """Correctly generates comparison plots"""
     input_dirs = [self.timing_dir, self.timing_dir_2]
     labels = ['foo', 'bar']
     stdout_red = OutputRedirect()
     with stdout_red as out:
         time_fig, mem_fig = compare_benchmark_results(input_dirs, labels)
         obs_out = out.getvalue()
     self.assertEqual(time_fig.__class__, Figure)
     self.assertEqual(mem_fig.__class__, Figure)
     exp = ("Warning - File %s/20/5.txt not used:\nWarning - File "
         "%s/20/5.txt not used:\n" % (self.timing_dir, self.timing_dir_2))
     self.assertEqual(obs_out, exp)
Пример #2
0
 def test_compare_benchmark_results(self):
     """Correctly generates comparison plots"""
     input_dirs = [self.timing_dir, self.timing_dir_2]
     labels = ['foo', 'bar']
     stdout_red = OutputRedirect()
     with stdout_red as out:
         time_fig, mem_fig = compare_benchmark_results(input_dirs, labels)
         obs_out = out.getvalue()
     self.assertEqual(time_fig.__class__, Figure)
     self.assertEqual(mem_fig.__class__, Figure)
     exp = ("Warning - File %s/20/5.txt not used:\nWarning - File "
            "%s/20/5.txt not used:\n" %
            (self.timing_dir, self.timing_dir_2))
     self.assertEqual(obs_out, exp)
    def run(self, **kwargs):
        bench_results = list(kwargs['bench_results'])
        labels = kwargs['labels']

        if len(bench_results) < 2:
            raise CommandError("You should provide at least two directories "
                               "with the benchmark results")
        if len(bench_results) != len(labels):
            raise CommandError("The number of results and the number of labels"
                               " should match: %s != %s" % (len(bench_results),
                                                            len(labels)))

        data = compare_benchmark_results(bench_results, labels)

        return {'comp_data': data}
    def run(self, **kwargs):
        result = {}

        input_dirs = kwargs['input_dirs']
        labels = kwargs['labels']

        if len(input_dirs) < 2:
            raise CommandError("You should provide at least two directories "
                "with the benchmark results")

        time_fig, mem_fig = compare_benchmark_results(input_dirs, labels)

        result['time_fig'] = time_fig
        result['mem_fig'] = mem_fig
        
        return result
Пример #5
0
 def test_compare_benchmark_results(self):
     """Correctly generates the strucute for comparing the benchmark results
     """
     obs = compare_benchmark_results(self.results, self.labels)
     exp = CompData(['10', '20', '30'],
                    {'data_series_1': ([102.4, 154.8, 209.282],
                                       [1.8547237, 4.57820926, 2.76194424]),
                     'data_series_2': ([102.4, 154.8, 209.282],
                                       [1.8547237, 4.57820926, 2.76194424])
                     },
                    {'data_series_1': ([2528.4, 5153.2, 10537.2],
                                       [5.23832034, 35.65052594,
                                        68.93591227]),
                     'data_series_2': ([2528.4, 5153.2, 10537.2],
                                       [5.23832034, 35.65052594,
                                        68.93591227])
                     })
     self.assertEqual(obs, exp)
Пример #6
0
 def test_compare_benchmark_results_error(self):
     """Raises an error if the tests are not from the same bench suite"""
     with self.assertRaises(ValueError):
         compare_benchmark_results(self.results_error, self.labels)