Test that ``clone_repo`` creates parent directories if they don't exist. Given a local path with non-existent parent directories: When ``clone_repo`` is called, Then it should create the parent directories before attempting to clone.
(tmp_path: Path, run_command_mock: AsyncMock)
| 245 | |
| 246 | @pytest.mark.asyncio |
| 247 | async def test_clone_creates_parent_directory(tmp_path: Path, run_command_mock: AsyncMock) -> None: |
| 248 | """Test that ``clone_repo`` creates parent directories if they don't exist. |
| 249 | |
| 250 | Given a local path with non-existent parent directories: |
| 251 | When ``clone_repo`` is called, |
| 252 | Then it should create the parent directories before attempting to clone. |
| 253 | """ |
| 254 | expected_call_count = GIT_INSTALLED_CALLS + 4 # ensure_git_installed + resolve_commit + clone + fetch + checkout |
| 255 | nested_path = tmp_path / "deep" / "nested" / "path" / "repo" |
| 256 | |
| 257 | clone_config = CloneConfig(url=DEMO_URL, local_path=str(nested_path)) |
| 258 | |
| 259 | await clone_repo(clone_config) |
| 260 | |
| 261 | assert nested_path.parent.exists() |
| 262 | assert_standard_calls(run_command_mock, clone_config, commit=DEMO_COMMIT) |
| 263 | assert run_command_mock.call_count == expected_call_count |
| 264 | |
| 265 | |
| 266 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected