@@ -40,7 +40,7 @@ def _get_branch_remote(script, package_name, branch):
40
40
return result .stdout .strip ()
41
41
42
42
43
- def _github_checkout (url_path , temp_dir , egg = None , scheme = None ):
43
+ def _github_checkout (url_path , temp_dir , rev = None , egg = None , scheme = None ):
44
44
"""
45
45
Call local_checkout() with a GitHub URL, and return the resulting URL.
46
46
@@ -56,6 +56,8 @@ def _github_checkout(url_path, temp_dir, egg=None, scheme=None):
56
56
scheme = 'https'
57
57
url = 'git+{}://github.com/{}' .format (scheme , url_path )
58
58
local_url = local_checkout (url , temp_dir .join ('cache' ))
59
+ if rev is not None :
60
+ local_url += '@{}' .format (rev )
59
61
if egg is not None :
60
62
local_url += '#egg={}' .format (egg )
61
63
@@ -150,7 +152,7 @@ def test_install_editable_from_git_with_https(script, tmpdir):
150
152
"""
151
153
url_path = 'pypa/pip-test-package.git'
152
154
local_url = _github_checkout (url_path , tmpdir , egg = 'pip-test-package' )
153
- result = script .pip ('install' , '-e' , local_url , expect_error = True )
155
+ result = script .pip ('install' , '-e' , local_url )
154
156
result .assert_installed ('pip-test-package' , with_files = ['.git' ])
155
157
156
158
@@ -184,9 +186,7 @@ def test_git_with_sha1_revisions(script):
184
186
'git' , 'rev-parse' , 'HEAD~1' ,
185
187
cwd = version_pkg_path ,
186
188
).stdout .strip ()
187
- version = _install_version_pkg (
188
- script , version_pkg_path , rev = sha1 , expect_stderr = True ,
189
- )
189
+ version = _install_version_pkg (script , version_pkg_path , rev = sha1 )
190
190
assert '0.1' == version
191
191
192
192
@@ -200,9 +200,7 @@ def test_git_with_short_sha1_revisions(script):
200
200
'git' , 'rev-parse' , 'HEAD~1' ,
201
201
cwd = version_pkg_path ,
202
202
).stdout .strip ()[:7 ]
203
- version = _install_version_pkg (
204
- script , version_pkg_path , rev = sha1 , expect_stderr = True ,
205
- )
203
+ version = _install_version_pkg (script , version_pkg_path , rev = sha1 )
206
204
assert '0.1' == version
207
205
208
206
@@ -212,11 +210,7 @@ def test_git_with_branch_name_as_revision(script):
212
210
"""
213
211
version_pkg_path = _create_test_package (script )
214
212
branch = 'test_branch'
215
- script .run (
216
- 'git' , 'checkout' , '-b' , branch ,
217
- expect_stderr = True ,
218
- cwd = version_pkg_path ,
219
- )
213
+ script .run ('git' , 'checkout' , '-b' , branch , cwd = version_pkg_path )
220
214
_change_test_package_version (script , version_pkg_path )
221
215
version = _install_version_pkg (script , version_pkg_path , rev = branch )
222
216
assert 'some different version' == version
@@ -227,11 +221,7 @@ def test_git_with_tag_name_as_revision(script):
227
221
Git backend should be able to install from tag names
228
222
"""
229
223
version_pkg_path = _create_test_package (script )
230
- script .run (
231
- 'git' , 'tag' , 'test_tag' ,
232
- expect_stderr = True ,
233
- cwd = version_pkg_path ,
234
- )
224
+ script .run ('git' , 'tag' , 'test_tag' , cwd = version_pkg_path )
235
225
_change_test_package_version (script , version_pkg_path )
236
226
version = _install_version_pkg (script , version_pkg_path , rev = 'test_tag' )
237
227
assert '0.1' == version
@@ -241,7 +231,7 @@ def _add_ref(script, path, ref):
241
231
"""
242
232
Add a new ref to a repository at the given path.
243
233
"""
244
- script .run ('git' , 'update-ref' , ref , 'HEAD' , expect_stderr = True , cwd = path )
234
+ script .run ('git' , 'update-ref' , ref , 'HEAD' , cwd = path )
245
235
246
236
247
237
def test_git_install_ref (script ):
@@ -253,7 +243,7 @@ def test_git_install_ref(script):
253
243
_change_test_package_version (script , version_pkg_path )
254
244
255
245
version = _install_version_pkg (
256
- script , version_pkg_path , rev = 'refs/foo/bar' , expect_stderr = True ,
246
+ script , version_pkg_path , rev = 'refs/foo/bar' ,
257
247
)
258
248
assert '0.1' == version
259
249
@@ -267,14 +257,12 @@ def test_git_install_then_install_ref(script):
267
257
_add_ref (script , version_pkg_path , 'refs/foo/bar' )
268
258
_change_test_package_version (script , version_pkg_path )
269
259
270
- version = _install_version_pkg (
271
- script , version_pkg_path , expect_stderr = True ,
272
- )
260
+ version = _install_version_pkg (script , version_pkg_path )
273
261
assert 'some different version' == version
274
262
275
263
# Now install the ref.
276
264
version = _install_version_pkg (
277
- script , version_pkg_path , rev = 'refs/foo/bar' , expect_stderr = True ,
265
+ script , version_pkg_path , rev = 'refs/foo/bar' ,
278
266
)
279
267
assert '0.1' == version
280
268
@@ -286,14 +274,13 @@ def test_git_with_tag_name_and_update(script, tmpdir):
286
274
"""
287
275
url_path = 'pypa/pip-test-package.git'
288
276
local_url = _github_checkout (url_path , tmpdir , egg = 'pip-test-package' )
289
- result = script .pip ('install' , '-e' , local_url , expect_error = True )
277
+ result = script .pip ('install' , '-e' , local_url )
290
278
result .assert_installed ('pip-test-package' , with_files = ['.git' ])
291
279
292
280
new_local_url = _github_checkout (url_path , tmpdir )
293
281
new_local_url += '@0.1.2#egg=pip-test-package'
294
282
result = script .pip (
295
283
'install' , '--global-option=--version' , '-e' , new_local_url ,
296
- expect_error = True ,
297
284
)
298
285
assert '0.1.2' in result .stdout
299
286
@@ -306,7 +293,7 @@ def test_git_branch_should_not_be_changed(script, tmpdir):
306
293
"""
307
294
url_path = 'pypa/pip-test-package.git'
308
295
local_url = _github_checkout (url_path , tmpdir , egg = 'pip-test-package' )
309
- script .pip ('install' , '-e' , local_url , expect_error = True )
296
+ script .pip ('install' , '-e' , local_url )
310
297
branch = _get_editable_branch (script , 'pip-test-package' )
311
298
assert 'master' == branch
312
299
@@ -316,11 +303,11 @@ def test_git_with_non_editable_unpacking(script, tmpdir):
316
303
"""
317
304
Test cloning a git repository from a non-editable URL with a given tag.
318
305
"""
319
- url_path = 'pypa/[email protected] #egg=pip-test-package'
320
- local_url = _github_checkout (url_path , tmpdir )
321
- result = script .pip (
322
- 'install' , '--global-option=--version' , local_url , expect_error = True ,
306
+ url_path = 'pypa/pip-test-package.git'
307
+ local_url = _github_checkout (
308
+ url_path , tmpdir , rev = '0.1.2' , egg = 'pip-test-package' ,
323
309
)
310
+ result = script .pip ('install' , '--global-option=--version' , local_url )
324
311
assert '0.1.2' in result .stdout
325
312
326
313
@@ -388,13 +375,8 @@ def test_editable__branch_with_sha_same_as_default(script):
388
375
"""
389
376
version_pkg_path = _create_test_package (script )
390
377
# Create a second branch with the same SHA.
391
- script .run (
392
- 'git' , 'branch' , 'develop' , expect_stderr = True ,
393
- cwd = version_pkg_path ,
394
- )
395
- _install_version_pkg_only (
396
- script , version_pkg_path , rev = 'develop' , expect_stderr = True
397
- )
378
+ script .run ('git' , 'branch' , 'develop' , cwd = version_pkg_path )
379
+ _install_version_pkg_only (script , version_pkg_path , rev = 'develop' )
398
380
399
381
branch = _get_editable_branch (script , 'version-pkg' )
400
382
assert branch == 'develop'
@@ -410,16 +392,11 @@ def test_editable__branch_with_sha_different_from_default(script):
410
392
"""
411
393
version_pkg_path = _create_test_package (script )
412
394
# Create a second branch.
413
- script .run (
414
- 'git' , 'branch' , 'develop' , expect_stderr = True ,
415
- cwd = version_pkg_path ,
416
- )
395
+ script .run ('git' , 'branch' , 'develop' , cwd = version_pkg_path )
417
396
# Add another commit to the master branch to give it a different sha.
418
397
_change_test_package_version (script , version_pkg_path )
419
398
420
- version = _install_version_pkg (
421
- script , version_pkg_path , rev = 'develop' , expect_stderr = True
422
- )
399
+ version = _install_version_pkg (script , version_pkg_path , rev = 'develop' )
423
400
assert version == '0.1'
424
401
425
402
branch = _get_editable_branch (script , 'version-pkg' )
@@ -437,10 +414,7 @@ def test_editable__non_master_default_branch(script):
437
414
version_pkg_path = _create_test_package (script )
438
415
# Change the default branch of the remote repo to a name that is
439
416
# alphabetically after "master".
440
- script .run (
441
- 'git' , 'checkout' , '-b' , 'release' , expect_stderr = True ,
442
- cwd = version_pkg_path ,
443
- )
417
+ script .run ('git' , 'checkout' , '-b' , 'release' , cwd = version_pkg_path )
444
418
_install_version_pkg_only (script , version_pkg_path )
445
419
446
420
branch = _get_editable_branch (script , 'version-pkg' )
@@ -492,7 +466,6 @@ def test_check_submodule_addition(script):
492
466
update_result = script .pip (
493
467
'install' , '-e' , 'git+' + module_path + '#egg=version_pkg' ,
494
468
'--upgrade' ,
495
- expect_error = True ,
496
469
)
497
470
498
471
assert (
0 commit comments