Skip to content

Commit

Permalink
chore: clean and update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
xxthunder committed Sep 21, 2024
1 parent b1c517e commit 7b2578a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions tests/utils.py → tests/cmake.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion tests/data/mini_c_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions tests/mini_c_test.py
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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()

0 comments on commit 7b2578a

Please sign in to comment.