Skip to content

Commit 5211a61

Browse files
committed
chore: clean and update examples
1 parent a0a02fb commit 5211a61

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

tests/utils.py renamed to tests/cmake.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#!/usr/bin/env python3
2-
31
from typing import List
42
from subprocess import Popen, PIPE
53

64
"""
7-
Utility functions needed by all test scripts.
5+
Helper functions to run CMake commands.
86
"""
97

108

11-
def run_process(args: List[str], cwd=None):
12-
with Popen(args, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True, cwd=cwd) as p:
9+
def run_process(args: List[str], cwd=None) -> int:
10+
with Popen(
11+
args, stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True, cwd=cwd
12+
) as p:
1313
for line in p.stdout:
1414
print(line, end="")
1515
for line in p.stderr:

tests/data/mini_c_test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ include(FetchContent)
1515
FetchContent_Declare(
1616
googletest
1717
GIT_REPOSITORY https://github.com/google/googletest.git
18-
GIT_TAG release-1.12.1
18+
GIT_TAG v1.15.2
1919
)
2020

2121
if(WIN32)

tests/mini_c_test.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
#!/usr/bin/env python3
2-
1+
from pathlib import Path
32
from platform import system
43

5-
from .utils import *
4+
from .cmake import cmake_configure, cmake_build_target
65

76

87
class TestMiniCProject:
9-
108
def test_build_and_test_mini_c_gmock(self):
119
project_dir = "tests/data/mini_c_test"
1210
build_dir = f"{project_dir}/build"
@@ -26,3 +24,4 @@ def test_build_and_test_mini_c_gmock(self):
2624
exit_code = cmake_build_target(build_dir, "all")
2725
"""CMake build shall be successful. The build includes the unit tests here."""
2826
assert exit_code == 0
27+
assert Path(binary).exists()

0 commit comments

Comments
 (0)