diff --git a/bin/rule_hook/test_rule_hook.py b/bin/rule_hook/test_rule_hook.py index c04c46ee..ded9dc2e 100644 --- a/bin/rule_hook/test_rule_hook.py +++ b/bin/rule_hook/test_rule_hook.py @@ -8,6 +8,7 @@ import subprocess import sys import tempfile import unittest +import unittest.mock sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) @@ -890,6 +891,11 @@ class TodoRankCheck(unittest.TestCase): checkout = self.changed_plan(f"{self.folder}/clone", "import sys\nsys.exit(3)\n") self.assertEqual(self.details(checkout), [f"{checkout}/bin/rank_todo.py --check failed with exit 3 and printed nothing"]) + def test_its_own_rank_todo_running_past_the_limit_is_named(self): + checkout = self.changed_plan(f"{self.folder}/clone", "import signal\nsignal.pause()\n") + with unittest.mock.patch("rule_hook.todo_check.OWN_CHECK_SECONDS", 0.2): + self.assertEqual(self.details(checkout), [f"{checkout}/bin/rank_todo.py --check did not finish in 0.2 seconds"]) + def test_another_repos_rank_todo_never_runs(self): reasons = self.details(self.changed_plan(self.other, self.STUB)) self.assertTrue(reasons)