diff --git a/tests/utils.py b/tests/cmake.py similarity index 67% rename from tests/utils.py rename to tests/cmake.py index 6123626..b8c8f69 100644 --- a/tests/utils.py +++ b/tests/cmake.py @@ -1,15 +1,15 @@ -#!/usr/bin/env python3 - from typing import List from subprocess import Popen, PIPE """ -Utility functions needed by all test scripts. +Helper functions to run CMake commands. """ -def run_process(args: List[str], cwd=None): - with Popen(args, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True, cwd=cwd) as p: +def run_process(args: List[str], cwd=None) -> int: + with Popen( + args, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True, cwd=cwd + ) as p: for line in p.stdout: print(line, end="") for line in p.stderr: diff --git a/tests/data/mini_c_test/CMakeLists.txt b/tests/data/mini_c_test/CMakeLists.txt index c59b31c..01ce02e 100644 --- a/tests/data/mini_c_test/CMakeLists.txt +++ b/tests/data/mini_c_test/CMakeLists.txt @@ -15,7 +15,7 @@ include(FetchContent) FetchContent_Declare( googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG release-1.12.1 + GIT_TAG v1.15.2 ) if(WIN32) diff --git a/tests/mini_c_test.py b/tests/mini_c_test.py index d65c9e6..2808964 100644 --- a/tests/mini_c_test.py +++ b/tests/mini_c_test.py @@ -1,12 +1,10 @@ -#!/usr/bin/env python3 - +from pathlib import Path from platform import system -from .utils import * +from .cmake import cmake_configure, cmake_build_target class TestMiniCProject: - def test_build_and_test_mini_c_gmock(self): project_dir = "tests/data/mini_c_test" build_dir = f"{project_dir}/build" @@ -26,3 +24,4 @@ def test_build_and_test_mini_c_gmock(self): exit_code = cmake_build_target(build_dir, "all") """CMake build shall be successful. The build includes the unit tests here.""" assert exit_code == 0 + assert Path(binary).exists()