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

Commitaba0494

Browse files
committed
Renamed refresh to setup and removed alias function & added unittest
Renamed to simplify and avoid issue with nose tests trying to use`setup` as a setup for testing. Unittest implements basic test forrefreshing with a bad git path versus a good git path.
1 parentfeed81e commitaba0494

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

‎git/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,16 @@ def _init_externals():
5858
__all__= [nameforname,objinlocals().items()
5959
ifnot (name.startswith('_')orinspect.ismodule(obj))]
6060

61+
6162
#{ Initialize git executable path
62-
defsetup(path=None):
63+
defrefresh(path=None):
6364
"""Convenience method for setting the git executable path."""
6465
ifnotGit.refresh(path=path):
6566
return
6667
ifnotFetchInfo.refresh():
6768
return
68-
69-
defrefresh(path=None):
70-
"""Convenience method for refreshing the git executable path."""
71-
setup(path=path)
7269
#} END initialize git executable path
7370

7471
#################
75-
setup()
72+
refresh()
7673
#################

‎git/test/test_git.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
fromgitimport (
1212
Git,
13+
refresh,
1314
GitCommandError,
1415
GitCommandNotFound,
1516
Repo,
@@ -156,6 +157,14 @@ def test_cmd_override(self):
156157
type(self.git).GIT_PYTHON_GIT_EXECUTABLE=prev_cmd
157158
# END undo adjustment
158159

160+
deftest_refresh(self):
161+
# test a bad git path refresh
162+
self.assertRaises(GitCommandNotFound,refresh,"yada")
163+
164+
# test a good path refresh
165+
path=os.popen("which git").read().strip()
166+
refresh(path)
167+
159168
deftest_options_are_passed_to_git(self):
160169
# This work because any command after git --version is ignored
161170
git_version=self.git(version=True).NoOp()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp