def _add_test_hook_stats(self, test_file, duration, num_run): """Add the statistics for a hook.""" test_name = testname.split_test_hook_name(test_file)[0] self._add_runtime_info(self._hook_runtime_by_test, test_name, duration, num_run)
def test_split_test_hook_name_should_throw_exception(self): with self.assertRaises(AssertionError): testname_utils.split_test_hook_name("test")
def test_split_test_hook_returns_test_name_and_hook(self): (test_name, hook_name) = testname_utils.split_test_hook_name("test:hook") self.assertEqual(test_name, "test") self.assertEqual(hook_name, "hook")
def hook_name(self) -> str: """Get the name of this hook.""" return split_test_hook_name(self.hook_id)[-1]
def test_name(self) -> str: """Get the name of the test associated with this hook.""" return split_test_hook_name(self.hook_id)[0]
def _add_test_hook_stats(self, test_file: str, duration: float, num_run: int) -> None: """Add the statistics for a hook.""" test_name, hook_name = testname.split_test_hook_name(test_file) self._hook_runtime_by_test[test_name][hook_name].add_runtimes(duration, num_run)