From 7a76da393a9ade07f8bfdc8763b05f74307f937a Mon Sep 17 00:00:00 2001 From: Steve Robinson Date: Mon, 17 Jul 2023 18:11:30 -0700 Subject: [PATCH] Add test coverage --- tests/resources/cmake_module/CMakeLists.txt | 5 +++++ tests/test_smoke.py | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/resources/cmake_module/CMakeLists.txt diff --git a/tests/resources/cmake_module/CMakeLists.txt b/tests/resources/cmake_module/CMakeLists.txt new file mode 100644 index 00000000..e94e56b0 --- /dev/null +++ b/tests/resources/cmake_module/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.24) +project(MyApp CXX) + +set(CMAKE_CXX_STANDARD 17) +find_package(Threads REQUIRED) diff --git a/tests/test_smoke.py b/tests/test_smoke.py index ffde2ae3..2f1b77cb 100644 --- a/tests/test_smoke.py +++ b/tests/test_smoke.py @@ -134,6 +134,20 @@ def test_reconfigure_on_conanfile_changes(self, capfd, chdir_build): assert all(expected in out for expected in expected_conan_install_outputs) +class TestCmakeModule: + @pytest.fixture(scope="class", autouse=True) + def cmake_module_setup(self): + src_dir = Path(__file__).parent.parent + shutil.copytree(src_dir / 'tests' / 'resources' / 'cmake_module', ".", dirs_exist_ok=True) + yield + + def test_cmake_module(self, capfd, chdir_build): + "Ensure that the Find.cmake modules from the CMake install work" + run("cmake .. -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -DCMAKE_BUILD_TYPE=Release") + out, _ = capfd.readouterr() + assert "Found Threads: TRUE" in out + + class TestSubdir: @pytest.fixture(scope="class", autouse=True) def subdir_setup(self):