Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite3e5687

Browse files
committed
Fix tests for Python <3.9 which lack Path.with_stem
1 parent2940662 commite3e5687

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎test/test_git.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ def _fake_git(*version_info):
8787
yieldstr(fake_git.absolute())
8888

8989

90+
def_rename_with_stem(path,new_stem):
91+
ifsys.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+
9097
@ddt.ddt
9198
classTestGit(TestBase):
9299
@classmethod
@@ -647,10 +654,10 @@ def test_successful_default_refresh_invalidates_cached_version_info(self):
647654
stack.enter_context(mock.patch.object(Git,"USE_SHELL",True))
648655

649656
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.
651658
refresh()
652659
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.
654661
self.assertEqual(new_git.version_info, (22,222,2),"stale version")
655662
refresh()
656663
self.assertEqual(new_git.version_info, (11,111,1),"fresh version")

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp