Skip to content

Commit ad0eecd

Browse files
committed
Update test_conan_cmake.py
1 parent f97d2ce commit ad0eecd

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/integration/examples/test_conan_cmake.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,28 @@ def _ensure_conan_config(pyproject_data: dict) -> None:
9191
if 'conan' not in pyproject_data['tool']['cppython']['providers']:
9292
pyproject_data['tool']['cppython']['providers']['conan'] = {}
9393

94+
@staticmethod
95+
def _verify_conan_package_configs(package_name: str, expected_build_types: list[str]) -> None:
96+
"""Verify that specified build types exist in the Conan local cache.
97+
98+
Args:
99+
package_name: Name of the package to check (e.g., 'mathutils')
100+
expected_build_types: List of build types that should exist (e.g., ['Release', 'Debug'])
101+
"""
102+
result = subprocess.run(
103+
['conan', 'list', f'{package_name}/*:*'],
104+
capture_output=True,
105+
text=True,
106+
check=False,
107+
)
108+
assert result.returncode == 0, f'Failed to list Conan packages: {result.stderr}'
109+
110+
output = result.stdout
111+
for build_type in expected_build_types:
112+
assert f'build_type: {build_type}' in output, (
113+
f'{build_type} configuration not found in Conan cache for {package_name}. Output: {output}'
114+
)
115+
94116
@staticmethod
95117
def test_simple(example_runner: CliRunner) -> None:
96118
"""Simple project"""
@@ -153,6 +175,10 @@ def test_library(example_runner: CliRunner) -> None:
153175
publish_project = TestConanCMake._create_project(skip_upload=True)
154176
publish_project.publish()
155177

178+
# Verify both Debug and Release configurations were published and consumed successfully
179+
# conan create already runs test_package for each build type, verifying consumption works
180+
TestConanCMake._verify_conan_package_configs('mathutils', ['Release', 'Debug'])
181+
156182
@staticmethod
157183
def test_extension(example_runner: CliRunner) -> None:
158184
"""Test Python extension module built with cppython.build backend and scikit-build-core"""

0 commit comments

Comments
 (0)