diff options
-rw-r--r-- | rh/hooks.py | 2 | ||||
-rwxr-xr-x | rh/hooks_unittest.py | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/rh/hooks.py b/rh/hooks.py index 643001c..6cb3214 100644 --- a/rh/hooks.py +++ b/rh/hooks.py @@ -1042,10 +1042,10 @@ BUILTIN_HOOKS = { 'commit_msg_bug_field': check_commit_msg_bug_field, 'commit_msg_changeid_field': check_commit_msg_changeid_field, 'commit_msg_prebuilt_apk_fields': check_commit_msg_prebuilt_apk_fields, - 'commit_msg_test_field': check_commit_msg_test_field, 'commit_msg_relnote_field_format': check_commit_msg_relnote_field_format, 'commit_msg_relnote_for_current_txt': check_commit_msg_relnote_for_current_txt, + 'commit_msg_test_field': check_commit_msg_test_field, 'cpplint': check_cpplint, 'gofmt': check_gofmt, 'google_java_format': check_google_java_format, diff --git a/rh/hooks_unittest.py b/rh/hooks_unittest.py index 389aad8..f522ee9 100755 --- a/rh/hooks_unittest.py +++ b/rh/hooks_unittest.py @@ -267,6 +267,20 @@ class UtilsTests(unittest.TestCase): self.assertTrue(isinstance(ret, str)) self.assertNotEqual(ret, '') + def testSortedToolPaths(self): + """Check TOOL_PATHS is sorted.""" + # This assumes dictionary key ordering matches insertion/definition + # order which Python 3.7+ has codified. + # https://docs.python.org/3.7/library/stdtypes.html#dict + self.assertEqual(list(rh.hooks.TOOL_PATHS), sorted(rh.hooks.TOOL_PATHS)) + + def testSortedBuiltinHooks(self): + """Check BUILTIN_HOOKS is sorted.""" + # This assumes dictionary key ordering matches insertion/definition + # order which Python 3.7+ has codified. + # https://docs.python.org/3.7/library/stdtypes.html#dict + self.assertEqual( + list(rh.hooks.BUILTIN_HOOKS), sorted(rh.hooks.BUILTIN_HOOKS)) @mock.patch.object(rh.utils, 'run') |