| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2940662 commit e3e5687
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -87,6 +87,13 @@ def _fake_git(*version_info): | |||
| 87 | 87 | yield str(fake_git.absolute()) | |
| 88 | 88 | ||
| 89 | 89 | ||
| 90 | + def _rename_with_stem(path, new_stem): | ||
| 91 | + if sys.version_info >= (3, 9): | ||
| 92 | + path.rename(path.with_stem(new_stem)) | ||
| 93 | + else: | ||
| 94 | + path.rename(path.with_name(new_stem + path.suffix)) | ||
| 95 | + | ||
| 96 | + | ||
| 90 | 97 | @ddt.ddt | |
| 91 | 98 | class TestGit(TestBase): | |
| 92 | 99 | @classmethod | |
@@ -647,10 +654,10 @@ def test_successful_default_refresh_invalidates_cached_version_info(self): | |||
| 647 | 654 | stack.enter_context(mock.patch.object(Git, "USE_SHELL", True)) | |
| 648 | 655 | ||
| 649 | 656 | new_git = Git() | |
| 650 | - path2.rename(path2.with_stem("git")) # "Install" git, "late" in the PATH. | ||
| 657 | + _rename_with_stem(path2, "git") # "Install" git, "late" in the PATH. | ||
| 651 | 658 | refresh() | |
| 652 | 659 | self.assertEqual(new_git.version_info, (22, 222, 2), 'before "downgrade"') | |
| 653 | - path1.rename(path1.with_stem("git")) # "Install" another, higher priority. | ||
| 660 | + _rename_with_stem(path1, "git") # "Install" another, higher priority. | ||
| 654 | 661 | self.assertEqual(new_git.version_info, (22, 222, 2), "stale version") | |
| 655 | 662 | refresh() | |
| 656 | 663 | self.assertEqual(new_git.version_info, (11, 111, 1), "fresh version") | |
| Back | FazBrowse Home | New Git URL |
0 commit comments