Skip to content

Commit acbc13d

Browse files
committed
refactor(test_validate_hook.py): Added extra testcase to verify no-matching exclude_files option
1 parent 1b2a68d commit acbc13d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

numpydoc/tests/hooks/test_validate_hook.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,13 @@ def test_validate_hook_with_toml_config(example_module, tmp_path, capsys):
139139
assert capsys.readouterr().err.strip() == expected
140140

141141

142-
def test_validate_hook_with_toml_config_exclude_files(example_module, tmp_path, capsys):
142+
@pytest.mark.parametrize(
143+
"regex, expected_code",
144+
[(".*/example.*\.py", 0), (".*/non_existent_match.*\.py", 1)],
145+
)
146+
def test_validate_hook_with_toml_config_exclude_files(
147+
example_module, tmp_path, capsys, regex, expected_code
148+
):
143149
"""
144150
Test that a file is correctly processed in the absence of config files
145151
with command line ignore options.
@@ -160,16 +166,17 @@ def test_validate_hook_with_toml_config_exclude_files(example_module, tmp_path,
160166
override_SS05 = [
161167
'^Creates',
162168
]
163-
164169
exclude_files = [
165-
'.*/example.*\.py',
170+
"""
171+
+ regex
172+
+ """
166173
]
167174
"""
168175
)
169176
)
170177

171178
return_code = run_hook([example_module], config=tmp_path)
172-
assert return_code == 0 # Should report no findings.
179+
assert return_code == expected_code # Should not-report/report findings.
173180

174181

175182
def test_validate_hook_with_setup_cfg(example_module, tmp_path, capsys):

0 commit comments

Comments
 (0)