@@ -179,6 +179,56 @@ def test_install_editable_from_git_autobuild_wheel(script, tmpdir):
179
179
_test_install_editable_from_git (script , tmpdir , True )
180
180
181
181
182
+ def test_install_editable_uninstalls_existing (data , script , tmpdir ):
183
+ """
184
+ Test that installing an editable uninstalls a previously installed
185
+ non-editable version.
186
+ https://github.com/pypa/pip/issues/1548
187
+ https://github.com/pypa/pip/pull/1552
188
+ """
189
+ to_install = data .packages .join ("pip-test-package-0.1.tar.gz" )
190
+ result = script .pip_install_local (to_install )
191
+ assert 'Successfully installed pip-test-package' in result .stdout
192
+ result .assert_installed ('piptestpackage' , editable = False )
193
+
194
+ result = script .pip (
195
+ 'install' , '-e' ,
196
+ '%s#egg=pip-test-package' %
197
+ local_checkout (
198
+ 'git+http://github.com/pypa/pip-test-package.git' ,
199
+ tmpdir .join ("cache" ),
200
+ ),
201
+ )
202
+ result .assert_installed ('pip-test-package' , with_files = ['.git' ])
203
+ assert 'Found existing installation: pip-test-package 0.1' in result .stdout
204
+ assert 'Uninstalling pip-test-package-' in result .stdout
205
+ assert 'Successfully uninstalled pip-test-package' in result .stdout
206
+
207
+
208
+ def test_install_editable_uninstalls_existing_from_path (script , data ):
209
+ """
210
+ Test that installing an editable uninstalls a previously installed
211
+ non-editable version from path
212
+ """
213
+ to_install = data .src .join ('simplewheel-1.0' )
214
+ result = script .pip_install_local (to_install )
215
+ assert 'Successfully installed simplewheel' in result .stdout
216
+ simple_folder = script .site_packages / 'simple'
217
+ result .assert_installed ('simple' , editable = False )
218
+ assert simple_folder in result .files_created , str (result .stdout )
219
+
220
+ result = script .pip (
221
+ 'install' , '-e' ,
222
+ to_install ,
223
+ )
224
+ install_path = script .site_packages / 'simplewheel.egg-link'
225
+ assert install_path in result .files_created , str (result )
226
+ assert 'Found existing installation: simplewheel 1.0' in result .stdout
227
+ assert 'Uninstalling simplewheel-' in result .stdout
228
+ assert 'Successfully uninstalled simplewheel' in result .stdout
229
+ assert simple_folder in result .files_deleted , str (result .stdout )
230
+
231
+
182
232
def test_install_editable_from_hg (script , tmpdir ):
183
233
"""Test cloning from Mercurial."""
184
234
pkg_path = _create_test_package (script , name = 'testpackage' , vcs = 'hg' )
0 commit comments