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

Commitc1cedc5

Browse files
committed
test: make git-daemon port configurable via env
add a GIT_PYTHON_TEST_GIT_DAEMON_PORT to set a port other than 9418,for example for when you already have a daemon running on that port.
1 parentbccdb48 commitc1cedc5

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

‎git/test/lib/helper.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
osp=os.path.dirname
1919

2020
GIT_REPO=os.environ.get("GIT_PYTHON_TEST_GIT_REPO_BASE",osp(osp(osp(osp(__file__)))))
21+
GIT_DAEMON_PORT=os.environ.get("GIT_PYTHON_TEST_GIT_DAEMON_PORT","9418")
2122

2223
__all__= (
2324
'fixture_path','fixture','absolute_project_path','StringProcessAdapter',
24-
'with_rw_repo','with_rw_and_rw_remote_repo','TestBase','TestCase','GIT_REPO'
25+
'with_rw_repo','with_rw_and_rw_remote_repo','TestBase','TestCase','GIT_REPO','GIT_DAEMON_PORT'
2526
)
2627

2728
#{ Routines
@@ -193,14 +194,15 @@ def remote_repo_creator(self):
193194
# by the user, not by us
194195
d_remote=Remote.create(rw_repo,"daemon_origin",remote_repo_dir)
195196
d_remote.fetch()
196-
remote_repo_url="git://localhost%s"%remote_repo_dir
197+
remote_repo_url="git://localhost:%s%s"%(GIT_DAEMON_PORT,remote_repo_dir)
197198

198199
d_remote.config_writer.set('url',remote_repo_url)
199200

200201
temp_dir=osp(_mktemp())
201202
# On windows, this will fail ... we deal with failures anyway and default to telling the user to do it
202203
try:
203-
gd=Git().daemon(temp_dir,enable='receive-pack',listen='127.0.0.1',as_process=True)
204+
gd=Git().daemon(temp_dir,enable='receive-pack',listen='127.0.0.1',port=GIT_DAEMON_PORT,
205+
as_process=True)
204206
# yes, I know ... fortunately, this is always going to work if sleep time is just large enough
205207
time.sleep(0.5)
206208
exceptException:
@@ -223,6 +225,8 @@ def remote_repo_creator(self):
223225
raiseAssertionError(msg)
224226
else:
225227
msg='Please start a git-daemon to run this test, execute: git daemon --enable=receive-pack "%s"'
228+
msg+='You can also run the daemon on a different port by passing --port=<port>'
229+
msg+='and setting the environment variable GIT_PYTHON_TEST_GIT_DAEMON_PORT to <port>'
226230
msg%=temp_dir
227231
raiseAssertionError(msg)
228232
# END make assertion

‎git/test/test_remote.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
TestBase,
99
with_rw_repo,
1010
with_rw_and_rw_remote_repo,
11-
fixture
11+
fixture,
12+
GIT_DAEMON_PORT
1213
)
1314
fromgitimport (
1415
RemoteProgress,
@@ -250,7 +251,7 @@ def get_info(res, remote, name):
250251
# must clone with a local path for the repo implementation not to freak out
251252
# as it wants local paths only ( which I can understand )
252253
other_repo=remote_repo.clone(other_repo_dir,shared=False)
253-
remote_repo_url="git://localhost%s"%remote_repo.git_dir
254+
remote_repo_url="git://localhost:%s%s"%(GIT_DAEMON_PORT,remote_repo.git_dir)
254255

255256
# put origin to git-url
256257
other_origin=other_repo.remotes.origin

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp