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(
82
82
expected_loaded_configuration = get_expected_configuration (
83
83
configuration_path , default_configuration
84
84
)
85
+ runner = None # The runner can fail to init if conf is bad enough.
85
86
with warnings .catch_warnings ():
86
87
warnings .filterwarnings (
87
88
"ignore" , message = "The use of 'MASTER'.*" , category = UserWarning
88
89
)
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
+
91
103
out , err = capsys .readouterr ()
92
104
# 'rstrip()' applied, so we can have a final newline in the expected test file
93
105
assert expected_output .rstrip () == out .rstrip (), msg
You can’t perform that action at this time.
0 commit comments