Skip to content

Commit ae625e6

Browse files
committed
Fix clang-tidy jobs tests for export-fixes fallback
1 parent 93848ed commit ae625e6

1 file changed

Lines changed: 36 additions & 6 deletions

File tree

tests/test_clang_tidy.py

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -261,8 +261,7 @@ def fake_exec(command):
261261
"--jobs=4",
262262
"-p",
263263
"./build",
264-
"--export-fixes",
265-
"fixes.yaml",
264+
"--header-filter=.*",
266265
"a.cpp",
267266
"b.cpp",
268267
]
@@ -284,15 +283,46 @@ def test_jobs_parallelizes_only_trailing_source_files():
284283
"--jobs=2",
285284
"-p",
286285
"./build",
287-
"--export-fixes",
288-
"fixes.yaml",
286+
"--header-filter=.*",
289287
"a.cpp",
290288
"b.hpp",
291289
]
292290
)
293291

294292
commands = {tuple(call.args[0]) for call in mock_exec.call_args_list}
295293
assert commands == {
296-
("clang-tidy", "-p", "./build", "--export-fixes", "fixes.yaml", "a.cpp"),
297-
("clang-tidy", "-p", "./build", "--export-fixes", "fixes.yaml", "b.hpp"),
294+
("clang-tidy", "-p", "./build", "--header-filter=.*", "a.cpp"),
295+
("clang-tidy", "-p", "./build", "--header-filter=.*", "b.hpp"),
298296
}
297+
298+
299+
def test_jobs_with_export_fixes_forces_serial_execution():
300+
with (
301+
patch(
302+
"cpp_linter_hooks.clang_tidy._exec_clang_tidy", return_value=(0, "")
303+
) as mock_exec,
304+
patch("cpp_linter_hooks.clang_tidy.resolve_install"),
305+
):
306+
run_clang_tidy(
307+
[
308+
"--jobs=4",
309+
"-p",
310+
"./build",
311+
"--export-fixes",
312+
"fixes.yaml",
313+
"a.cpp",
314+
"b.cpp",
315+
]
316+
)
317+
318+
mock_exec.assert_called_once_with(
319+
[
320+
"clang-tidy",
321+
"-p",
322+
"./build",
323+
"--export-fixes",
324+
"fixes.yaml",
325+
"a.cpp",
326+
"b.cpp",
327+
]
328+
)

0 commit comments

Comments
 (0)