File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -82,12 +82,24 @@ def test_functional_config_loading(
8282 expected_loaded_configuration = get_expected_configuration (
8383 configuration_path , default_configuration
8484 )
85+ runner = None # The runner can fail to init if conf is bad enough.
8586 with warnings .catch_warnings ():
8687 warnings .filterwarnings (
8788 "ignore" , message = "The use of 'MASTER'.*" , category = UserWarning
8889 )
89- runner = run_using_a_configuration_file (configuration_path , file_to_lint_path )
90- assert runner .linter .msg_status == expected_code
90+ try :
91+ runner = run_using_a_configuration_file (
92+ configuration_path , file_to_lint_path
93+ )
94+ assert runner .linter .msg_status == expected_code
95+ except SystemExit as e :
96+ # Case where the conf exit with an argparse error
97+ assert e .code == expected_code
98+ out , err = capsys .readouterr ()
99+ assert out == ""
100+ assert err .rstrip () == expected_output .rstrip ()
101+ return
102+
91103 out , err = capsys .readouterr ()
92104 # 'rstrip()' applied, so we can have a final newline in the expected test file
93105 assert expected_output .rstrip () == out .rstrip (), msg
You can’t perform that action at this time.
0 commit comments