Skip to content

Commit 6312e16

Browse files
committed
Update the Example Tests
1 parent d674f82 commit 6312e16

File tree

3 files changed

+10
-28
lines changed

3 files changed

+10
-28
lines changed

cppython/plugins/conan/plugin.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,16 @@ def install(self) -> None:
7373

7474
self.builder.generate_conanfile(self.core_data.project_data.project_root, resolved_dependencies)
7575

76+
self.core_data.cppython_data.build_path.mkdir(parents=True, exist_ok=True)
77+
7678
def update(self) -> None:
7779
"""Updates the provider"""
7880
resolved_dependencies = [resolve_conan_dependency(req) for req in self.core_data.cppython_data.dependencies]
7981

8082
self.builder.generate_conanfile(self.core_data.project_data.project_root, resolved_dependencies)
8183

84+
self.core_data.cppython_data.build_path.mkdir(parents=True, exist_ok=True)
85+
8286
@staticmethod
8387
def supported_sync_type(sync_type: type[SyncData]) -> bool:
8488
"""Checks if the given sync type is supported by the Conan provider.

tests/integration/examples/test_conan_cmake.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,8 @@ def test_simple(example_runner: CliRunner) -> None:
2929
assert result.exit_code == 0, result.output
3030

3131
# Run the CMake configuration command
32-
cmake_result = subprocess.run(['cmake', '--preset=default'], capture_output=True, text=True, check=False)
32+
cmake_result = subprocess.run(
33+
['cmake', '--preset=default', '-B', 'build'], capture_output=True, text=True, check=False
34+
)
3335

3436
assert cmake_result.returncode == 0, f'CMake configuration failed: {cmake_result.stderr}'
35-
36-
# Run the CMake build command
37-
build_result = subprocess.run(['cmake', '--build', 'build'], capture_output=True, text=True, check=False)
38-
39-
assert build_result.returncode == 0, f'CMake build failed: {build_result.stderr}'
40-
assert 'Build finished successfully' in build_result.stdout, 'CMake build did not finish successfully'
41-
42-
# Execute the built program and verify the output
43-
program_result = subprocess.run(['build/HelloWorld'], capture_output=True, text=True, check=False)
44-
45-
assert program_result.returncode == 0, f'Program execution failed: {program_result.stderr}'
46-
47-
assert 'Hello, World!' in program_result.stdout, 'Program output did not match expected output'

tests/integration/examples/test_vcpkg_cmake.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,8 @@ def test_simple(example_runner: CliRunner) -> None:
3131
assert result.exit_code == 0, result.output
3232

3333
# Run the CMake configuration command
34-
cmake_result = subprocess.run(['cmake', '--preset=default'], capture_output=True, text=True, check=False)
34+
cmake_result = subprocess.run(
35+
['cmake', '--preset=default', '-B', 'build'], capture_output=True, text=True, check=False
36+
)
3537

3638
assert cmake_result.returncode == 0, f'CMake configuration failed: {cmake_result.stderr}'
37-
38-
# Run the CMake build command
39-
build_result = subprocess.run(['cmake', '--build', 'build'], capture_output=True, text=True, check=False)
40-
41-
assert build_result.returncode == 0, f'CMake build failed: {build_result.stderr}'
42-
assert 'Build finished successfully' in build_result.stdout, 'CMake build did not finish successfully'
43-
44-
# Execute the built program and verify the output
45-
program_result = subprocess.run(['build/HelloWorld'], capture_output=True, text=True, check=False)
46-
47-
assert program_result.returncode == 0, f'Program execution failed: {program_result.stderr}'
48-
49-
assert 'Hello, World!' in program_result.stdout, 'Program output did not match expected output'

0 commit comments

Comments
 (0)