Skip to content

Commit 66ff8e0

Browse files
committed
add test for --egg option
1 parent 93cd6b1 commit 66ff8e0

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

tests/test_basic.py

+14
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,20 @@ def test_install_from_local_directory_with_no_setup_py():
302302
assert "is not installable. File 'setup.py' not found." in result.stdout
303303

304304

305+
def test_install_as_egg():
306+
"""
307+
Test installing as egg, instead of flat install.
308+
"""
309+
env = reset_env()
310+
to_install = abspath(join(here, 'packages', 'FSPkg'))
311+
result = run_pip('install', to_install, '--egg', expect_error=False)
312+
fspkg_folder = env.site_packages/'fspkg'
313+
egg_folder = env.site_packages/'FSPkg-0.1dev-py%s.egg' % pyversion
314+
assert fspkg_folder not in result.files_created, str(result.stdout)
315+
assert egg_folder in result.files_created, str(result)
316+
assert join(egg_folder, 'fspkg') in result.files_created, str(result)
317+
318+
305319
def test_install_curdir():
306320
"""
307321
Test installing current directory ('.').

tests/test_uninstall.py

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import textwrap
22
import sys
3-
from os.path import join
3+
from os.path import join, abspath
44
from tempfile import mkdtemp
5-
from tests.test_pip import reset_env, run_pip, assert_all_changes, write_file
5+
from tests.test_pip import here, reset_env, run_pip, assert_all_changes, write_file, pyversion
66
from tests.local_repos import local_repo, local_checkout
77

88
from pip.util import rmtree
@@ -137,3 +137,21 @@ def test_uninstall_from_reqs_file():
137137
result2 = run_pip('uninstall', '-r', 'test-req.txt', '-y')
138138
assert_all_changes(
139139
result, result2, [env.venv/'build', env.venv/'src', env.scratch/'test-req.txt'])
140+
141+
142+
def test_uninstall_as_egg():
143+
"""
144+
Test uninstall package installed as egg.
145+
146+
"""
147+
env = reset_env()
148+
to_install = abspath(join(here, 'packages', 'FSPkg'))
149+
result = run_pip('install', to_install, '--egg', expect_error=False)
150+
fspkg_folder = env.site_packages/'fspkg'
151+
egg_folder = env.site_packages/'FSPkg-0.1dev-py%s.egg' % pyversion
152+
assert fspkg_folder not in result.files_created, str(result.stdout)
153+
assert egg_folder in result.files_created, str(result)
154+
155+
result2 = run_pip('uninstall', 'FSPkg', '-y', expect_error=True)
156+
assert_all_changes(result, result2, [env.venv/'build', 'cache'])
157+

0 commit comments

Comments
 (0)