| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2bfd829 commit ef28587
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,6 +9,7 @@ | |||
| 9 | 9 | import shutil | |
| 10 | 10 | import sys | |
| 11 | 11 | import tempfile | |
| 12 | + from types import SimpleNamespace | ||
| 12 | 13 | from unittest import mock, skipUnless | |
| 13 | 14 | ||
| 14 | 15 | import pytest | |
@@ -316,8 +317,9 @@ def test_submodule_allows_symlink_above_worktree( | |||
| 316 | 317 | def metadata_realpath(request): | |
| 317 | 318 | """Model Python 3.7 on Windows without altering pathlib's own resolver.""" | |
| 318 | 319 | if request.param: | |
| 319 | - with mock.patch("git.objects.submodule.base.osp", wraps=osp) as paths: | ||
| 320 | - paths.realpath.side_effect = osp.abspath | ||
| 320 | + paths = SimpleNamespace(**vars(osp)) | ||
| 321 | + paths.realpath = osp.abspath | ||
| 322 | + with mock.patch("git.objects.submodule.base.osp", paths): | ||
| 321 | 323 | yield | |
| 322 | 324 | else: | |
| 323 | 325 | yield | |
@@ -361,7 +363,7 @@ def test_submodule_allows_existing_metadata_symlinks( | |||
| 361 | 363 | ||
| 362 | 364 | Cover linked metadata directories, gitfiles, configs, and internal aliases. | |
| 363 | 365 | Update, move, and rename must retain a usable checkout; forced removal must | |
| 364 | - still remove it. | ||
| 366 | + still remove both the checkout and the resolved metadata directory. | ||
| 365 | 367 | """ | |
| 366 | 368 | sm = movable_submodule | |
| 367 | 369 | sm.rename("nested/module") | |
@@ -387,8 +389,11 @@ def test_submodule_allows_existing_metadata_symlinks( | |||
| 387 | 389 | sm.repo.git.config("--file", str(modules / "nested/module/config"), "core.worktree", str(root / "module")) | |
| 388 | 390 | assert sm.module_exists() | |
| 389 | 391 | if operation == "remove": | |
| 392 | + metadata_dir = (modules / "nested/module").resolve() | ||
| 393 | + assert metadata_dir.is_dir() | ||
| 390 | 394 | sm.remove(force=True) | |
| 391 | 395 | assert not (root / "module").exists() | |
| 396 | + assert not metadata_dir.exists() | ||
| 392 | 397 | return | |
| 393 | 398 | if operation == "update": | |
| 394 | 399 | sm.update() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments