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

Commit2eac36c

Browse files
committed
Have _fake_git fixture take version_info
This reorganization is to facilitate using two separate fake gitcommands with different versions, in forthcoming tests.
1 parent3f107d5 commit2eac36c

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

‎test/test_git.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
fromgit.utilimportcwd,finalize_process
2929
fromtest.libimportTestBase,fixture_path,with_rw_directory
3030

31-
_FAKE_GIT_VERSION_INFO= (123,456,789)
32-
3331

3432
@contextlib.contextmanager
3533
def_patch_out_env(name):
@@ -70,8 +68,8 @@ def _rollback_refresh():
7068

7169

7270
@contextlib.contextmanager
73-
def_fake_git():
74-
fake_version=".".join(str(field)forfieldin_FAKE_GIT_VERSION_INFO)
71+
def_fake_git(*version_info):
72+
fake_version=".".join(map(str,version_info))
7573
fake_output=f"git version{fake_version} (fake)"
7674

7775
withtempfile.TemporaryDirectory()astdir:
@@ -505,17 +503,18 @@ def test_refresh_with_good_relative_git_path_arg(self):
505503
self.assertEqual(self.git.GIT_PYTHON_GIT_EXECUTABLE,absolute_path)
506504

507505
deftest_version_info_is_cached(self):
506+
fake_version_info= (123,456,789)
508507
with_rollback_refresh():
509-
with_fake_git()aspath:
508+
with_fake_git(*fake_version_info)aspath:
510509
new_git=Git()# Not cached yet.
511510
refresh(path)
512-
self.assertEqual(new_git.version_info,_FAKE_GIT_VERSION_INFO)
511+
self.assertEqual(new_git.version_info,fake_version_info)
513512
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)
515514

516515
deftest_version_info_cache_is_per_instance(self):
517516
with_rollback_refresh():
518-
with_fake_git()aspath:
517+
with_fake_git(123,456,789)aspath:
519518
git1=Git()
520519
git2=Git()
521520
refresh(path)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp