mirror of https://github.com/pypa/pip
Don't assume master branch exists when reinstalling editable package from Git (#4450)
* Add failing test * Don't assume master branch is default * Don't expect output to stderr * Use the 'short ref' instead of the 'full ref'
This commit is contained in:
parent
e3288bb15c
commit
8d96363882
|
@ -0,0 +1,2 @@
|
|||
Reinstalling an editable package from Git no longer assumes that the ``master``
|
||||
branch exists.
|
|
@ -132,7 +132,7 @@ class Git(VersionControl):
|
|||
rev_options = [rev]
|
||||
rev_display = ' (to %s)' % rev
|
||||
else:
|
||||
rev_options = ['origin/master']
|
||||
rev_options = ['origin/HEAD']
|
||||
rev_display = ''
|
||||
if self.check_destination(dest, url, rev_options, rev_display):
|
||||
logger.info(
|
||||
|
|
|
@ -253,3 +253,32 @@ def test_git_works_with_editable_non_origin_repo(script):
|
|||
assert "Error when trying to get requirement" in result.stderr
|
||||
assert "Could not determine repository location" in result.stdout
|
||||
assert "version-pkg==0.1" in result.stdout
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_reinstalling_works_with_editible_non_master_branch(script):
|
||||
"""
|
||||
Reinstalling an editable installation should not assume that the "master"
|
||||
branch exists. See https://github.com/pypa/pip/issues/4448.
|
||||
"""
|
||||
version_pkg_path = _create_test_package(script)
|
||||
|
||||
# Switch the default branch to something other than 'master'
|
||||
script.run('git', 'branch', '-m', 'foobar', cwd=version_pkg_path)
|
||||
|
||||
script.pip(
|
||||
'install', '-e',
|
||||
'%s#egg=version_pkg' %
|
||||
('git+file://' + version_pkg_path.abspath.replace('\\', '/')),
|
||||
)
|
||||
version = script.run('version_pkg')
|
||||
assert '0.1' in version.stdout
|
||||
|
||||
_change_test_package_version(script, version_pkg_path)
|
||||
script.pip(
|
||||
'install', '-e',
|
||||
'%s#egg=version_pkg' %
|
||||
('git+file://' + version_pkg_path.abspath.replace('\\', '/')),
|
||||
)
|
||||
version = script.run('version_pkg')
|
||||
assert 'some different version' in version.stdout
|
||||
|
|
Loading…
Reference in New Issue