| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3f107d5 commit 2eac36c
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -28,8 +28,6 @@ | |||
| 28 | 28 | from git.util import cwd, finalize_process | |
| 29 | 29 | from test.lib import TestBase, fixture_path, with_rw_directory | |
| 30 | 30 | ||
| 31 | - _FAKE_GIT_VERSION_INFO = (123, 456, 789) | ||
| 32 | - | ||
| 33 | 31 | ||
| 34 | 32 | @contextlib.contextmanager | |
| 35 | 33 | def _patch_out_env(name): | |
@@ -70,8 +68,8 @@ def _rollback_refresh(): | |||
| 70 | 68 | ||
| 71 | 69 | ||
| 72 | 70 | @contextlib.contextmanager | |
| 73 | - def _fake_git(): | ||
| 74 | - fake_version = ".".join(str(field) for field in _FAKE_GIT_VERSION_INFO) | ||
| 71 | + def _fake_git(*version_info): | ||
| 72 | + fake_version = ".".join(map(str, version_info)) | ||
| 75 | 73 | fake_output = f"git version {fake_version} (fake)" | |
| 76 | 74 | ||
| 77 | 75 | with tempfile.TemporaryDirectory() as tdir: | |
@@ -505,17 +503,18 @@ def test_refresh_with_good_relative_git_path_arg(self): | |||
| 505 | 503 | self.assertEqual(self.git.GIT_PYTHON_GIT_EXECUTABLE, absolute_path) | |
| 506 | 504 | ||
| 507 | 505 | def test_version_info_is_cached(self): | |
| 506 | + fake_version_info = (123, 456, 789) | ||
| 508 | 507 | with _rollback_refresh(): | |
| 509 | - with _fake_git() as path: | ||
| 508 | + with _fake_git(*fake_version_info) as path: | ||
| 510 | 509 | new_git = Git() # Not cached yet. | |
| 511 | 510 | refresh(path) | |
| 512 | - self.assertEqual(new_git.version_info, _FAKE_GIT_VERSION_INFO) | ||
| 511 | + self.assertEqual(new_git.version_info, fake_version_info) | ||
| 513 | 512 | os.remove(path) # Arrange that a second subprocess call would fail. | |
| 514 | - self.assertEqual(new_git.version_info, _FAKE_GIT_VERSION_INFO) | ||
| 513 | + self.assertEqual(new_git.version_info, fake_version_info) | ||
| 515 | 514 | ||
| 516 | 515 | def test_version_info_cache_is_per_instance(self): | |
| 517 | 516 | with _rollback_refresh(): | |
| 518 | - with _fake_git() as path: | ||
| 517 | + with _fake_git(123, 456, 789) as path: | ||
| 519 | 518 | git1 = Git() | |
| 520 | 519 | git2 = Git() | |
| 521 | 520 | refresh(path) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments