Find all unit test files in the tests directory. Args: project_dir: Project root directory Returns: List of TestMatch objects for unit tests
(project_dir: Path)
| 261 | |
| 262 | |
| 263 | def _find_unit_tests(project_dir: Path) -> list[TestMatch]: |
| 264 | """Find all unit test files in the tests directory. |
| 265 | |
| 266 | Args: |
| 267 | project_dir: Project root directory |
| 268 | |
| 269 | Returns: |
| 270 | List of TestMatch objects for unit tests |
| 271 | """ |
| 272 | tests_dir = project_dir / "tests" |
| 273 | if not tests_dir.exists(): |
| 274 | return [] |
| 275 | |
| 276 | matches: list[TestMatch] = [] |
| 277 | |
| 278 | # Find all .cpp files in tests directory |
| 279 | for cpp_file in tests_dir.rglob("*.cpp"): |
| 280 | # Get test name (filename without extension) |
| 281 | test_name = cpp_file.stem |
| 282 | |
| 283 | # Get relative path from project root |
| 284 | rel_path = cpp_file.relative_to(project_dir) |
| 285 | |
| 286 | matches.append( |
| 287 | TestMatch( |
| 288 | name=test_name, |
| 289 | path=str(rel_path).replace("\\", "/"), |
| 290 | type="unit_test", |
| 291 | score=0.0, # Will be calculated during matching |
| 292 | ) |
| 293 | ) |
| 294 | |
| 295 | return matches |
| 296 | |
| 297 | |
| 298 | def _find_examples(project_dir: Path) -> list[TestMatch]: |
no test coverage detected