def _add_stats(self, test_stats): """Add the statistics found in a document returned by the Evergreen test_stats/ endpoint.""" test_file = testname.normalize_test_file(test_stats["test_file"]) duration = test_stats["avg_duration_pass"] num_run = test_stats["num_pass"] is_hook = testname.is_resmoke_hook(test_file) if is_hook: self._add_test_hook_stats(test_file, duration, num_run) else: self._add_test_stats(test_file, duration, num_run)
def _add_stats(self, test_stats): """Add the statistics found in a document returned by the Evergreen test_stats/ endpoint.""" test_file = testname.normalize_test_file(test_stats["test_file"]) duration = test_stats["avg_duration_pass"] num_run = test_stats["num_pass"] is_hook = testname.is_resmoke_hook(test_file) if is_hook: self._add_test_hook_stats(test_file, duration, num_run) else: self._add_test_stats(test_file, duration, num_run)
def from_stats_list(cls, historic_stats: List[TestStats]) -> "HistoricTaskData": """ Build historic task data from a list of historic stats. :param historic_stats: List of historic stats to build from. :return: Historic task data from the list of stats. """ hooks = defaultdict(list) for hook in [ stat for stat in historic_stats if is_resmoke_hook(stat.test_file) ]: historical_hook = HistoricHookInfo.from_test_stats(hook) hooks[historical_hook.test_name()].append(historical_hook) return cls([ HistoricTestInfo.from_test_stats( stat, hooks[get_short_name_from_test_file(stat.test_file)]) for stat in historic_stats if not is_resmoke_hook(stat.test_file) ])
def test_is_a_test_hook_false(self): self.assertFalse(testname_utils.is_resmoke_hook("testnameWithoutHook"))
def test_is_a_test_hook_true(self): self.assertTrue(testname_utils.is_resmoke_hook("testname:hook"))