@@ -54,10 +54,8 @@ def _get_opts(
5454 color = False ,
5555 verbose = False ,
5656 hook = None ,
57- no_stash = False ,
5857 origin = '' ,
5958 source = '' ,
60- allow_unstaged_config = False ,
6159 hook_stage = 'commit' ,
6260 show_diff_on_failure = False ,
6361 commit_msg_filename = '' ,
@@ -70,10 +68,8 @@ def _get_opts(
7068 color = color ,
7169 verbose = verbose ,
7270 hook = hook ,
73- no_stash = no_stash ,
7471 origin = origin ,
7572 source = source ,
76- allow_unstaged_config = allow_unstaged_config ,
7773 hook_stage = hook_stage ,
7874 show_diff_on_failure = show_diff_on_failure ,
7975 commit_msg_filename = commit_msg_filename ,
@@ -332,38 +328,6 @@ def test_origin_source_error_msg(
332328 assert warning_msg not in printed
333329
334330
335- @pytest .mark .parametrize (
336- ('no_stash' , 'all_files' , 'expect_stash' ),
337- (
338- (True , True , False ),
339- (True , False , False ),
340- (False , True , False ),
341- (False , False , True ),
342- ),
343- )
344- def test_no_stash (
345- cap_out ,
346- repo_with_passing_hook ,
347- no_stash ,
348- all_files ,
349- expect_stash ,
350- mock_out_store_directory ,
351- ):
352- stage_a_file ()
353- # Make unstaged changes
354- with open ('foo.py' , 'w' ) as foo_file :
355- foo_file .write ('import os\n ' )
356-
357- args = _get_opts (no_stash = no_stash , all_files = all_files )
358- ret , printed = _do_run (cap_out , repo_with_passing_hook , args )
359- assert ret == 0
360- warning_msg = b'[WARNING] Unstaged files detected.'
361- if expect_stash :
362- assert warning_msg in printed
363- else :
364- assert warning_msg not in printed
365-
366-
367331@pytest .mark .parametrize (('output' , 'expected' ), (('some' , True ), ('' , False )))
368332def test_has_unmerged_paths (output , expected ):
369333 mock_runner = mock .Mock ()
@@ -715,37 +679,19 @@ def modified_config_repo(repo_with_passing_hook):
715679 yield repo_with_passing_hook
716680
717681
718- def test_allow_unstaged_config_option (
682+ def test_error_with_unstaged_config (
719683 cap_out , modified_config_repo , mock_out_store_directory ,
720684):
721- args = _get_opts (allow_unstaged_config = True )
722- ret , printed = _do_run (cap_out , modified_config_repo , args )
723- expected = (
724- b'You have an unstaged config file and have specified the '
725- b'--allow-unstaged-config option.'
726- )
727- assert expected in printed
728- assert ret == 0
729-
730-
731- def test_no_allow_unstaged_config_option (
732- cap_out , modified_config_repo , mock_out_store_directory ,
733- ):
734- args = _get_opts (allow_unstaged_config = False )
685+ args = _get_opts ()
735686 ret , printed = _do_run (cap_out , modified_config_repo , args )
736687 assert b'Your .pre-commit-config.yaml is unstaged.' in printed
737688 assert ret == 1
738689
739690
740691@pytest .mark .parametrize (
741- 'opts' ,
742- (
743- {'allow_unstaged_config' : False , 'no_stash' : True },
744- {'all_files' : True },
745- {'files' : [C .CONFIG_FILE ]},
746- ),
692+ 'opts' , ({'all_files' : True }, {'files' : [C .CONFIG_FILE ]}),
747693)
748- def test_unstaged_message_suppressed (
694+ def test_no_unstaged_error_with_all_files_or_files (
749695 cap_out , modified_config_repo , mock_out_store_directory , opts ,
750696):
751697 args = _get_opts (** opts )
0 commit comments