diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt new file mode 100644 index 0000000..919c604 --- /dev/null +++ b/testing/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.15) + +# Set the project name to your project name +project(main C CXX) + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +add_executable(main_app + ${CMAKE_BINARY_SOURCE_DIR}main.c +) +target_include_directories(main_app PUBLIC ${CMAKE_BINARY_SOURCE_DIR}) diff --git a/tests/test_clang_tidy.py b/tests/test_clang_tidy.py index 16f6ef2..4259a9b 100644 --- a/tests/test_clang_tidy.py +++ b/tests/test_clang_tidy.py @@ -1,4 +1,5 @@ import pytest +import subprocess from pathlib import Path from cpp_linter_hooks.clang_tidy import run_clang_tidy @@ -11,6 +12,7 @@ ), ) def test_run_clang_tidy_valid(args, expected_retval, tmp_path): + subprocess.run(['mkdir', '-p', 'build', '&&', 'cmake', '-Bbuild', 'testing/'], shell=True) # copy test file to tmp_path to prevent modifying repo data test_file = tmp_path / "main.c" test_file.write_bytes(Path("testing/main.c").read_bytes())