|
4 | 4 | The tests ensure that the projects build, configure, and execute correctly. |
5 | 5 | """ |
6 | 6 |
|
7 | | -import os |
8 | | -import shutil |
9 | 7 | import subprocess |
10 | 8 | from pathlib import Path |
11 | 9 | from tomllib import loads |
@@ -103,63 +101,3 @@ def test_library(example_runner: CliRunner) -> None: |
103 | 101 | # Package the library to local cache |
104 | 102 | publish_project = TestConanCMake._create_project(skip_upload=True) |
105 | 103 | publish_project.publish() |
106 | | - |
107 | | - @staticmethod |
108 | | - def _publish_library_to_cache() -> None: |
109 | | - """Helper method to publish the library to local Conan cache""" |
110 | | - examples_root = Path(__file__).parent.parent.parent.parent / 'examples' |
111 | | - library_source = examples_root / 'conan_cmake' / 'library' |
112 | | - library_temp = Path('temp_library') |
113 | | - |
114 | | - # Clean up any existing temp directory first |
115 | | - if library_temp.exists(): |
116 | | - shutil.rmtree(library_temp) |
117 | | - |
118 | | - # Copy library to temp location |
119 | | - shutil.copytree(library_source, library_temp) |
120 | | - |
121 | | - # Change to library directory and publish it |
122 | | - original_cwd = Path.cwd() |
123 | | - try: |
124 | | - os.chdir(library_temp) |
125 | | - |
126 | | - # Create and configure library project |
127 | | - lib_project = TestConanCMake._create_project(skip_upload=True) |
128 | | - lib_project.install() |
129 | | - |
130 | | - # Build and publish library |
131 | | - TestConanCMake._run_cmake_configure() |
132 | | - TestConanCMake._run_cmake_build() |
133 | | - lib_project.publish() |
134 | | - |
135 | | - finally: |
136 | | - os.chdir(original_cwd) |
137 | | - # Clean up temp directory |
138 | | - if library_temp.exists(): |
139 | | - shutil.rmtree(library_temp) |
140 | | - |
141 | | - @staticmethod |
142 | | - def test_library_consumer(example_runner: CliRunner) -> None: |
143 | | - """Test that a consumer can use the published library""" |
144 | | - # First, publish the library to the local cache |
145 | | - TestConanCMake._publish_library_to_cache() |
146 | | - |
147 | | - # Create consumer project and install dependencies |
148 | | - consumer_project = TestConanCMake._create_project(skip_upload=False) |
149 | | - consumer_project.install() |
150 | | - |
151 | | - # Configure and build the consumer |
152 | | - TestConanCMake._run_cmake_configure() |
153 | | - TestConanCMake._run_cmake_build() |
154 | | - build_path = TestConanCMake._verify_build_artifacts() |
155 | | - |
156 | | - # Verify the executable was created and works |
157 | | - exe_files = list(build_path.glob('**/consumer*')) |
158 | | - assert len(exe_files) > 0, f'No consumer executable found in {build_path}' |
159 | | - |
160 | | - # Run the consumer to verify it works |
161 | | - exe_path = next((f for f in exe_files if f.suffix == '.exe' or f.is_file()), None) |
162 | | - if exe_path: |
163 | | - result = subprocess.run([str(exe_path)], capture_output=True, text=True, check=False) |
164 | | - assert result.returncode == 0, f'Consumer execution failed: {result.stderr}' |
165 | | - assert 'MathUtils' in result.stdout, f'Expected MathUtils output not found: {result.stdout}' |
0 commit comments