@@ -715,6 +715,7 @@ def test_local_python_repo(store, local_python_config):
715715def test_default_language_version (store , local_python_config ):
716716 config = {
717717 'default_language_version' : {'python' : 'fake' },
718+ 'default_stages' : ['commit' ],
718719 'repos' : [local_python_config ],
719720 }
720721
@@ -728,6 +729,23 @@ def test_default_language_version(store, local_python_config):
728729 assert hook .language_version == 'fake2'
729730
730731
732+ def test_default_stages (store , local_python_config ):
733+ config = {
734+ 'default_language_version' : {'python' : C .DEFAULT },
735+ 'default_stages' : ['commit' ],
736+ 'repos' : [local_python_config ],
737+ }
738+
739+ # `stages` was not set, should default
740+ hook , = all_hooks (config , store )
741+ assert hook .stages == ['commit' ]
742+
743+ # `stages` is set, should not default
744+ config ['repos' ][0 ]['hooks' ][0 ]['stages' ] = ['push' ]
745+ hook , = all_hooks (config , store )
746+ assert hook .stages == ['push' ]
747+
748+
731749def test_hook_id_not_present (tempdir_factory , store , fake_log_handler ):
732750 path = make_repo (tempdir_factory , 'script_hooks_repo' )
733751 config = make_config_from_repo (path )
@@ -786,13 +804,13 @@ def test_manifest_hooks(tempdir_factory, store):
786804 files = '' ,
787805 id = 'bash_hook' ,
788806 language = 'script' ,
789- language_version = C . DEFAULT ,
807+ language_version = 'default' ,
790808 log_file = '' ,
791809 minimum_pre_commit_version = '0' ,
792810 name = 'Bash hook' ,
793811 pass_filenames = True ,
794812 require_serial = False ,
795- stages = [] ,
813+ stages = ( 'commit' , 'commit-msg' , 'manual' , 'push' ) ,
796814 types = ['file' ],
797815 verbose = False ,
798816 )
0 commit comments