2014-11-19 23:05:14 +01:00
|
|
|
|
2010-08-06 20:10:16 +02:00
|
|
|
import os
|
2013-05-28 23:58:08 +02:00
|
|
|
import textwrap
|
2013-11-22 03:59:31 +01:00
|
|
|
import glob
|
2013-08-18 11:59:44 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
from os.path import join, curdir, pardir
|
2011-03-20 18:12:04 +01:00
|
|
|
|
2013-08-18 11:59:44 +02:00
|
|
|
import pytest
|
|
|
|
|
2014-08-31 01:52:28 +02:00
|
|
|
from pip.utils import rmtree
|
2013-08-23 13:12:37 +02:00
|
|
|
from tests.lib import pyversion
|
2013-06-13 08:36:16 +02:00
|
|
|
from tests.lib.local_repos import local_checkout
|
|
|
|
from tests.lib.path import Path
|
2013-06-12 22:58:37 +02:00
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2014-01-07 14:36:04 +01:00
|
|
|
def test_without_setuptools(script):
|
|
|
|
script.run("pip", "uninstall", "setuptools", "-y")
|
|
|
|
result = script.run(
|
2014-01-07 15:03:43 +01:00
|
|
|
"python", "-c",
|
|
|
|
"import pip; pip.main(['install', 'INITools==0.2', '--no-use-wheel'])",
|
2014-01-07 14:36:04 +01:00
|
|
|
expect_error=True,
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
"setuptools must be installed to install from a source distribution"
|
2014-01-28 15:17:51 +01:00
|
|
|
in result.stdout
|
2014-01-07 14:36:04 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_pip_second_command_line_interface_works(script):
|
2013-06-12 22:58:37 +02:00
|
|
|
"""
|
2013-07-14 16:32:36 +02:00
|
|
|
Check if ``pip<PYVERSION>`` commands behaves equally
|
2013-06-12 22:58:37 +02:00
|
|
|
"""
|
2013-07-14 16:32:36 +02:00
|
|
|
args = ['pip%s' % pyversion]
|
2013-06-12 22:58:37 +02:00
|
|
|
args.extend(['install', 'INITools==0.2'])
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.run(*args)
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
|
|
|
script.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion
|
|
|
|
)
|
2013-08-21 11:16:07 +02:00
|
|
|
initools_folder = script.site_packages / 'initools'
|
2013-06-12 22:58:37 +02:00
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
|
|
|
assert initools_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_from_pypi(script):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test installing a package from PyPI.
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', '-vvv', 'INITools==0.2')
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
|
|
|
script.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion
|
|
|
|
)
|
2013-08-21 11:16:07 +02:00
|
|
|
initools_folder = script.site_packages / 'initools'
|
2010-06-09 01:09:37 +02:00
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
|
|
|
assert initools_folder in result.files_created, str(result)
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_editable_install(script):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test editable installation.
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', '-e', 'INITools==0.2', expect_error=True)
|
2014-01-28 15:17:51 +01:00
|
|
|
assert (
|
|
|
|
"INITools==0.2 should either be a path to a local project or a VCS url"
|
|
|
|
in result.stdout
|
|
|
|
)
|
2014-08-31 01:52:28 +02:00
|
|
|
assert not result.files_created
|
|
|
|
assert not result.files_updated
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_install_editable_from_svn(script, tmpdir):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test checking out from svn.
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install',
|
|
|
|
'-e',
|
|
|
|
'%s#egg=initools-dev' %
|
|
|
|
local_checkout(
|
|
|
|
'svn+http://svn.colorstudy.com/INITools/trunk',
|
|
|
|
tmpdir.join("cache")
|
|
|
|
)
|
|
|
|
)
|
2010-04-28 22:55:10 +02:00
|
|
|
result.assert_installed('INITools', with_files=['.svn'])
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_download_editable_to_custom_path(script, tmpdir):
|
2010-04-15 13:01:36 +02:00
|
|
|
"""
|
|
|
|
Test downloading an editable using a relative custom src folder.
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
script.scratch_path.join("customdl").mkdir()
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install',
|
|
|
|
'-e',
|
|
|
|
'%s#egg=initools-dev' %
|
|
|
|
local_checkout(
|
|
|
|
'svn+http://svn.colorstudy.com/INITools/trunk',
|
|
|
|
tmpdir.join("cache")
|
|
|
|
),
|
|
|
|
'--src',
|
|
|
|
'customsrc',
|
|
|
|
'--download',
|
|
|
|
'customdl',
|
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
customsrc = Path('scratch') / 'customsrc' / 'initools'
|
2014-01-28 15:17:51 +01:00
|
|
|
assert customsrc in result.files_created, (
|
|
|
|
sorted(result.files_created.keys())
|
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
assert customsrc / 'setup.py' in result.files_created, (
|
2014-01-28 15:17:51 +01:00
|
|
|
sorted(result.files_created.keys())
|
|
|
|
)
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2014-02-24 22:52:23 +01:00
|
|
|
customdl = Path('scratch') / 'customdl' / 'initools'
|
2014-01-28 15:17:51 +01:00
|
|
|
customdl_files_created = [
|
|
|
|
filename for filename in result.files_created
|
|
|
|
if filename.startswith(customdl)
|
|
|
|
]
|
2010-06-09 01:09:37 +02:00
|
|
|
assert customdl_files_created
|
2010-04-15 13:01:36 +02:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_editable_no_install_followed_by_no_download(script, tmpdir):
|
2010-04-15 15:26:21 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
Test installing an editable in two steps (first with --no-install, then
|
|
|
|
with --no-download).
|
|
|
|
"""
|
|
|
|
result = script.pip(
|
|
|
|
'install',
|
|
|
|
'-e',
|
|
|
|
'%s#egg=initools-dev' %
|
|
|
|
local_checkout(
|
|
|
|
'svn+http://svn.colorstudy.com/INITools/trunk',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
'--no-install',
|
|
|
|
expect_error=True,
|
|
|
|
)
|
|
|
|
result.assert_installed(
|
|
|
|
'INITools', without_egg_link=True, with_files=['.svn'],
|
|
|
|
)
|
2010-04-15 15:26:21 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install',
|
|
|
|
'-e',
|
|
|
|
'%s#egg=initools-dev' %
|
|
|
|
local_checkout(
|
|
|
|
'svn+http://svn.colorstudy.com/INITools/trunk',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
'--no-download',
|
|
|
|
expect_error=True,
|
|
|
|
)
|
2010-04-28 22:55:10 +02:00
|
|
|
result.assert_installed('INITools', without_files=[curdir, '.svn'])
|
2010-04-15 15:26:21 +02:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_no_install_followed_by_no_download(script):
|
2010-04-15 15:26:21 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
Test installing in two steps (first with --no-install, then with
|
|
|
|
--no-download).
|
2010-04-15 15:26:21 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
2014-02-24 22:52:23 +01:00
|
|
|
script.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2014-02-24 22:52:23 +01:00
|
|
|
initools_folder = script.site_packages / 'initools'
|
|
|
|
build_dir = script.venv / 'build' / 'INITools'
|
2010-04-15 15:26:21 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
result1 = script.pip(
|
|
|
|
'install', 'INITools==0.2', '--no-install', expect_error=True,
|
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert egg_info_folder not in result1.files_created, str(result1)
|
2014-01-28 15:17:51 +01:00
|
|
|
assert initools_folder not in result1.files_created, (
|
|
|
|
sorted(result1.files_created)
|
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert build_dir in result1.files_created, result1.files_created
|
2014-02-24 22:52:23 +01:00
|
|
|
assert build_dir / 'INITools.egg-info' in result1.files_created
|
2010-06-09 01:09:37 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
result2 = script.pip(
|
|
|
|
'install', 'INITools==0.2', '--no-download', expect_error=True,
|
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert egg_info_folder in result2.files_created, str(result2)
|
2014-01-28 15:17:51 +01:00
|
|
|
assert initools_folder in result2.files_created, (
|
|
|
|
sorted(result2.files_created)
|
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert build_dir not in result2.files_created
|
2014-02-24 22:52:23 +01:00
|
|
|
assert build_dir / 'INITools.egg-info' not in result2.files_created
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_bad_install_with_no_download(script):
|
2010-04-15 17:08:02 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
Test that --no-download behaves sensibly if the package source can't be
|
|
|
|
found.
|
2010-04-15 17:08:02 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', 'INITools==0.2', '--no-download', expect_error=True,
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
"perhaps --no-download was used without first running "
|
|
|
|
"an equivalent install with --no-install?" in result.stdout
|
|
|
|
)
|
2010-04-15 17:08:02 +02:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_dev_version_from_pypi(script):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test using package==dev.
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2014-07-04 00:56:26 +02:00
|
|
|
'install', 'INITools===dev',
|
2014-01-28 15:17:51 +01:00
|
|
|
'--allow-external', 'INITools',
|
|
|
|
'--allow-unverified', 'INITools',
|
|
|
|
expect_error=True,
|
|
|
|
)
|
|
|
|
assert (script.site_packages / 'initools') in result.files_created, (
|
|
|
|
str(result.stdout)
|
|
|
|
)
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_install_editable_from_git(script, tmpdir):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test cloning from Git.
|
|
|
|
"""
|
2011-03-15 20:49:48 +01:00
|
|
|
args = ['install']
|
2014-01-28 15:17:51 +01:00
|
|
|
args.extend([
|
|
|
|
'-e',
|
|
|
|
'%s#egg=pip-test-package' %
|
|
|
|
local_checkout(
|
|
|
|
'git+http://github.com/pypa/pip-test-package.git',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
])
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip(*args, **{"expect_error": True})
|
2011-09-14 00:20:06 +02:00
|
|
|
result.assert_installed('pip-test-package', with_files=['.git'])
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_install_editable_from_hg(script, tmpdir):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test cloning from Mercurial.
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '-e',
|
|
|
|
'%s#egg=ScriptTest' %
|
|
|
|
local_checkout(
|
|
|
|
'hg+https://bitbucket.org/ianb/scripttest',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
expect_error=True,
|
|
|
|
)
|
2013-03-22 00:58:21 +01:00
|
|
|
result.assert_installed('ScriptTest', with_files=['.hg'])
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_vcs_url_final_slash_normalization(script, tmpdir):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test that presence or absence of final slash in VCS URL is normalized.
|
|
|
|
"""
|
2014-08-31 01:52:28 +02:00
|
|
|
script.pip(
|
2014-01-28 15:17:51 +01:00
|
|
|
'install', '-e',
|
|
|
|
'%s/#egg=ScriptTest' %
|
|
|
|
local_checkout(
|
|
|
|
'hg+https://bitbucket.org/ianb/scripttest',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
)
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_install_editable_from_bazaar(script, tmpdir):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test checking out from Bazaar.
|
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '-e',
|
|
|
|
'%s/@174#egg=django-wikiapp' %
|
|
|
|
local_checkout(
|
|
|
|
'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp'
|
|
|
|
'/release-0.1',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
expect_error=True,
|
|
|
|
)
|
2010-04-28 22:55:10 +02:00
|
|
|
result.assert_installed('django-wikiapp', with_files=['.bzr'])
|
2010-04-13 00:34:38 +02:00
|
|
|
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_vcs_url_urlquote_normalization(script, tmpdir):
|
2010-02-25 00:16:43 +01:00
|
|
|
"""
|
|
|
|
Test that urlquoted characters are normalized for repo URL comparison.
|
|
|
|
"""
|
2014-08-31 01:52:28 +02:00
|
|
|
script.pip(
|
2014-01-28 15:17:51 +01:00
|
|
|
'install', '-e',
|
|
|
|
'%s/#egg=django-wikiapp' %
|
|
|
|
local_checkout(
|
|
|
|
'bzr+http://bazaar.launchpad.net/%7Edjango-wikiapp/django-wikiapp'
|
|
|
|
'/release-0.1',
|
|
|
|
tmpdir.join("cache"),
|
|
|
|
),
|
|
|
|
)
|
2010-02-24 11:24:54 +01:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_from_local_directory(script, data):
|
2010-04-13 08:59:43 +02:00
|
|
|
"""
|
|
|
|
Test installing from a local directory.
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
to_install = data.packages.join("FSPkg")
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', to_install, expect_error=False)
|
2014-02-24 22:52:23 +01:00
|
|
|
fspkg_folder = script.site_packages / 'fspkg'
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
2014-11-19 23:05:14 +01:00
|
|
|
script.site_packages / 'FSPkg-0.1.dev0-py%s.egg-info' % pyversion
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert fspkg_folder in result.files_created, str(result.stdout)
|
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
2010-04-13 08:59:43 +02:00
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
def test_install_from_local_directory_with_symlinks_to_directories(
|
|
|
|
script, data):
|
2013-11-10 00:57:34 +01:00
|
|
|
"""
|
|
|
|
Test installing from a local directory containing symlinks to directories.
|
|
|
|
"""
|
|
|
|
to_install = data.packages.join("symlinks")
|
|
|
|
result = script.pip('install', to_install, expect_error=False)
|
2014-02-24 22:52:23 +01:00
|
|
|
pkg_folder = script.site_packages / 'symlinks'
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
2014-11-19 23:05:14 +01:00
|
|
|
script.site_packages / 'symlinks-0.1.dev0-py%s.egg-info' % pyversion
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2013-11-10 00:57:34 +01:00
|
|
|
assert pkg_folder in result.files_created, str(result.stdout)
|
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_from_local_directory_with_no_setup_py(script, data):
|
2010-04-13 18:12:50 +02:00
|
|
|
"""
|
|
|
|
Test installing from a local directory with no 'setup.py'.
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
result = script.pip('install', data.root, expect_error=True)
|
2014-08-31 01:52:28 +02:00
|
|
|
assert not result.files_created
|
2010-04-13 18:12:50 +02:00
|
|
|
assert "is not installable. File 'setup.py' not found." in result.stdout
|
|
|
|
|
2010-06-03 04:25:26 +02:00
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_editable_install_from_local_directory_with_no_setup_py(script, data):
|
2012-05-31 14:49:19 +02:00
|
|
|
"""
|
|
|
|
Test installing from a local directory with no 'setup.py'.
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
result = script.pip('install', '-e', data.root, expect_error=True)
|
2014-08-31 01:52:28 +02:00
|
|
|
assert not result.files_created
|
2012-05-31 14:49:19 +02:00
|
|
|
assert "is not installable. File 'setup.py' not found." in result.stdout
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_as_egg(script, data):
|
2012-05-22 12:54:40 +02:00
|
|
|
"""
|
|
|
|
Test installing as egg, instead of flat install.
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
to_install = data.packages.join("FSPkg")
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', to_install, '--egg', expect_error=False)
|
2014-02-24 22:52:23 +01:00
|
|
|
fspkg_folder = script.site_packages / 'fspkg'
|
2014-11-19 23:05:14 +01:00
|
|
|
egg_folder = script.site_packages / 'FSPkg-0.1.dev0-py%s.egg' % pyversion
|
2012-05-22 12:54:40 +02:00
|
|
|
assert fspkg_folder not in result.files_created, str(result.stdout)
|
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
assert join(egg_folder, 'fspkg') in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_curdir(script, data):
|
2010-04-10 11:57:49 +02:00
|
|
|
"""
|
|
|
|
Test installing current directory ('.').
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
run_from = data.packages.join("FSPkg")
|
2011-03-23 06:08:14 +01:00
|
|
|
# Python 2.4 Windows balks if this exists already
|
|
|
|
egg_info = join(run_from, "FSPkg.egg-info")
|
|
|
|
if os.path.isdir(egg_info):
|
|
|
|
rmtree(egg_info)
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', curdir, cwd=run_from, expect_error=False)
|
2014-02-24 22:52:23 +01:00
|
|
|
fspkg_folder = script.site_packages / 'fspkg'
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
2014-11-19 23:05:14 +01:00
|
|
|
script.site_packages / 'FSPkg-0.1.dev0-py%s.egg-info' % pyversion
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert fspkg_folder in result.files_created, str(result.stdout)
|
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
2010-04-10 11:57:49 +02:00
|
|
|
|
2010-08-19 17:40:21 +02:00
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_pardir(script, data):
|
2010-04-10 11:57:49 +02:00
|
|
|
"""
|
|
|
|
Test installing parent directory ('..').
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
run_from = data.packages.join("FSPkg", "fspkg")
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', pardir, cwd=run_from, expect_error=False)
|
2014-02-24 22:52:23 +01:00
|
|
|
fspkg_folder = script.site_packages / 'fspkg'
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
2014-11-19 23:05:14 +01:00
|
|
|
script.site_packages / 'FSPkg-0.1.dev0-py%s.egg-info' % pyversion
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2010-06-09 01:09:37 +02:00
|
|
|
assert fspkg_folder in result.files_created, str(result.stdout)
|
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
2010-05-30 14:39:11 +02:00
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_global_option(script):
|
2010-05-30 14:39:11 +02:00
|
|
|
"""
|
2010-06-09 01:09:37 +02:00
|
|
|
Test using global distutils options.
|
|
|
|
(In particular those that disable the actual install action)
|
2010-05-30 14:39:11 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '--global-option=--version', "INITools==0.1",
|
|
|
|
)
|
2010-05-30 14:39:11 +02:00
|
|
|
assert '0.1\n' in result.stdout
|
2010-08-06 17:41:49 +02:00
|
|
|
|
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_with_pax_header(script, data):
|
2010-09-07 19:26:13 +02:00
|
|
|
"""
|
|
|
|
test installing from a tarball with pax header for python<2.6
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
script.pip('install', 'paxpkg.tar.bz2', cwd=data.packages)
|
2010-09-07 19:26:13 +02:00
|
|
|
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_with_hacked_egg_info(script, data):
|
2012-06-25 17:47:12 +02:00
|
|
|
"""
|
|
|
|
test installing a package which defines its own egg_info class
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
run_from = data.packages.join("HackedEggInfo")
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', '.', cwd=run_from)
|
2014-12-23 12:14:35 +01:00
|
|
|
assert 'Successfully installed hackedegginfo-0.0.0\n' in result.stdout
|
2012-06-25 17:47:12 +02:00
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_install_using_install_option_and_editable(script, tmpdir):
|
2010-08-19 03:29:36 +02:00
|
|
|
"""
|
|
|
|
Test installing a tool using -e and --install-option
|
|
|
|
"""
|
2010-08-19 04:11:08 +02:00
|
|
|
folder = 'script_folder'
|
2013-08-21 11:16:07 +02:00
|
|
|
script.scratch_path.join(folder).mkdir()
|
2014-04-16 01:55:45 +02:00
|
|
|
url = 'git+git://github.com/pypa/pip-test-package'
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
2014-04-16 01:55:45 +02:00
|
|
|
'install', '-e', '%s#egg=pip-test-package' %
|
2014-01-28 15:17:51 +01:00
|
|
|
local_checkout(url, tmpdir.join("cache")),
|
|
|
|
'--install-option=--script-dir=%s' % folder
|
|
|
|
)
|
2014-04-16 01:55:45 +02:00
|
|
|
script_file = (
|
|
|
|
script.venv / 'src' / 'pip-test-package' /
|
|
|
|
folder / 'pip-test-package' + script.exe
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2014-04-16 01:55:45 +02:00
|
|
|
assert script_file in result.files_created
|
2010-08-19 03:29:36 +02:00
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 12:14:09 +02:00
|
|
|
def test_install_global_option_using_editable(script, tmpdir):
|
2010-08-19 03:29:36 +02:00
|
|
|
"""
|
|
|
|
Test using global distutils options, but in an editable installation
|
|
|
|
"""
|
2011-03-19 04:19:22 +01:00
|
|
|
url = 'hg+http://bitbucket.org/runeh/anyjson'
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '--global-option=--version', '-e',
|
|
|
|
'%s@0.2.5#egg=anyjson' % local_checkout(url, tmpdir.join("cache"))
|
|
|
|
)
|
2015-03-05 21:59:59 +01:00
|
|
|
assert 'Successfully installed anyjson' in result.stdout
|
2010-08-19 03:29:36 +02:00
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_package_with_same_name_in_curdir(script):
|
2010-08-06 17:41:49 +02:00
|
|
|
"""
|
|
|
|
Test installing a package with the same name of a local folder
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
script.scratch_path.join("mock==0.6").mkdir()
|
|
|
|
result = script.pip('install', 'mock==0.6')
|
|
|
|
egg_folder = script.site_packages / 'mock-0.6.0-py%s.egg-info' % pyversion
|
2010-08-06 17:41:49 +02:00
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
|
|
|
mock100_setup_py = textwrap.dedent('''\
|
|
|
|
from setuptools import setup
|
|
|
|
setup(name='mock',
|
|
|
|
version='100.1')''')
|
|
|
|
|
|
|
|
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_folder_using_dot_slash(script):
|
2010-08-06 17:41:49 +02:00
|
|
|
"""
|
|
|
|
Test installing a folder using pip install ./foldername
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
script.scratch_path.join("mock").mkdir()
|
2014-02-24 22:52:23 +01:00
|
|
|
pkg_path = script.scratch_path / 'mock'
|
2013-08-21 11:16:07 +02:00
|
|
|
pkg_path.join("setup.py").write(mock100_setup_py)
|
|
|
|
result = script.pip('install', './mock')
|
|
|
|
egg_folder = script.site_packages / 'mock-100.1-py%s.egg-info' % pyversion
|
2010-08-06 17:41:49 +02:00
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_folder_using_slash_in_the_end(script):
|
2010-08-06 20:05:00 +02:00
|
|
|
r"""
|
|
|
|
Test installing a folder using pip install foldername/ or foldername\
|
2010-08-06 17:41:49 +02:00
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
script.scratch_path.join("mock").mkdir()
|
2014-02-24 22:52:23 +01:00
|
|
|
pkg_path = script.scratch_path / 'mock'
|
2013-08-21 11:16:07 +02:00
|
|
|
pkg_path.join("setup.py").write(mock100_setup_py)
|
|
|
|
result = script.pip('install', 'mock' + os.path.sep)
|
|
|
|
egg_folder = script.site_packages / 'mock-100.1-py%s.egg-info' % pyversion
|
2010-08-06 17:41:49 +02:00
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_folder_using_relative_path(script):
|
2010-08-06 17:41:49 +02:00
|
|
|
"""
|
|
|
|
Test installing a folder using pip install folder1/folder2
|
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
script.scratch_path.join("initools").mkdir()
|
|
|
|
script.scratch_path.join("initools", "mock").mkdir()
|
2014-02-24 22:52:23 +01:00
|
|
|
pkg_path = script.scratch_path / 'initools' / 'mock'
|
2013-08-21 11:16:07 +02:00
|
|
|
pkg_path.join("setup.py").write(mock100_setup_py)
|
2014-02-24 22:52:23 +01:00
|
|
|
result = script.pip('install', Path('initools') / 'mock')
|
2013-08-21 11:16:07 +02:00
|
|
|
egg_folder = script.site_packages / 'mock-100.1-py%s.egg-info' % pyversion
|
2010-08-06 17:41:49 +02:00
|
|
|
assert egg_folder in result.files_created, str(result)
|
2010-12-09 04:15:53 +01:00
|
|
|
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_package_which_contains_dev_in_name(script):
|
2010-12-09 04:15:53 +01:00
|
|
|
"""
|
2011-03-19 04:19:22 +01:00
|
|
|
Test installing package from pypi which contains 'dev' in name
|
2010-12-09 04:15:53 +01:00
|
|
|
"""
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', 'django-devserver==0.0.4')
|
2014-02-24 22:52:23 +01:00
|
|
|
devserver_folder = script.site_packages / 'devserver'
|
2014-01-28 15:17:51 +01:00
|
|
|
egg_info_folder = (
|
2014-02-24 22:52:23 +01:00
|
|
|
script.site_packages / 'django_devserver-0.0.4-py%s.egg-info' %
|
|
|
|
pyversion
|
2014-01-28 15:17:51 +01:00
|
|
|
)
|
2010-12-09 04:15:53 +01:00
|
|
|
assert devserver_folder in result.files_created, str(result.stdout)
|
|
|
|
assert egg_info_folder in result.files_created, str(result)
|
2011-03-14 23:07:12 +01:00
|
|
|
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-08-22 06:40:46 +02:00
|
|
|
def test_install_package_with_target(script):
|
2012-02-03 13:31:28 +01:00
|
|
|
"""
|
|
|
|
Test installing a package using pip install --target
|
|
|
|
"""
|
2014-02-24 22:52:23 +01:00
|
|
|
target_dir = script.scratch_path / 'target'
|
2013-08-21 11:16:07 +02:00
|
|
|
result = script.pip('install', '-t', target_dir, "initools==0.1")
|
2014-02-24 22:52:23 +01:00
|
|
|
assert Path('scratch') / 'target' / 'initools' in result.files_created, (
|
2014-01-28 15:17:51 +01:00
|
|
|
str(result)
|
|
|
|
)
|
2012-02-03 13:31:28 +01:00
|
|
|
|
2014-08-31 02:15:32 +02:00
|
|
|
# Test repeated call without --upgrade, no files should have changed
|
|
|
|
result = script.pip('install', '-t', target_dir, "initools==0.1")
|
|
|
|
assert not Path('scratch') / 'target' / 'initools' in result.files_updated
|
|
|
|
|
|
|
|
# Test upgrade call, check that new version is installed
|
2014-08-31 03:25:03 +02:00
|
|
|
result = script.pip('install', '--upgrade', '-t',
|
|
|
|
target_dir, "initools==0.2")
|
2014-08-31 02:15:32 +02:00
|
|
|
assert Path('scratch') / 'target' / 'initools' in result.files_updated, (
|
|
|
|
str(result)
|
|
|
|
)
|
2014-08-31 03:25:03 +02:00
|
|
|
egg_folder = (
|
|
|
|
Path('scratch') / 'target' / 'INITools-0.2-py%s.egg-info' % pyversion)
|
|
|
|
assert egg_folder in result.files_created, (
|
2014-08-31 02:15:32 +02:00
|
|
|
str(result)
|
|
|
|
)
|
|
|
|
|
2014-08-31 18:11:27 +02:00
|
|
|
# Test install and upgrade of single-module package
|
|
|
|
result = script.pip('install', '-t', target_dir, 'six')
|
|
|
|
assert Path('scratch') / 'target' / 'six.py' in result.files_created, (
|
|
|
|
str(result)
|
|
|
|
)
|
|
|
|
|
|
|
|
result = script.pip('install', '-t', target_dir, '--upgrade', 'six')
|
|
|
|
assert Path('scratch') / 'target' / 'six.py' in result.files_updated, (
|
|
|
|
str(result)
|
|
|
|
)
|
|
|
|
|
2012-02-03 13:31:28 +01:00
|
|
|
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_package_with_root(script, data):
|
2012-10-02 05:55:56 +02:00
|
|
|
"""
|
|
|
|
Test installing a package using pip install --root
|
|
|
|
"""
|
2014-02-24 22:52:23 +01:00
|
|
|
root_dir = script.scratch_path / 'root'
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '--root', root_dir, '-f', data.find_links, '--no-index',
|
|
|
|
'simple==1.0',
|
|
|
|
)
|
|
|
|
normal_install_path = (
|
|
|
|
script.base_path / script.site_packages / 'simple-1.0-py%s.egg-info' %
|
|
|
|
pyversion
|
|
|
|
)
|
|
|
|
# use distutils to change the root exactly how the --root option does it
|
2013-02-14 04:17:28 +01:00
|
|
|
from distutils.util import change_root
|
2014-01-28 15:17:51 +01:00
|
|
|
root_path = change_root(
|
|
|
|
os.path.join(script.scratch, 'root'),
|
|
|
|
normal_install_path
|
|
|
|
)
|
2013-02-14 04:17:28 +01:00
|
|
|
assert root_path in result.files_created, str(result)
|
2012-10-02 05:55:56 +02:00
|
|
|
|
|
|
|
|
2013-08-18 11:59:44 +02:00
|
|
|
# skip on win/py3 for now, see issue #782
|
|
|
|
@pytest.mark.skipif("sys.platform == 'win32' and sys.version_info >= (3,)")
|
2013-08-23 13:12:37 +02:00
|
|
|
def test_install_package_that_emits_unicode(script, data):
|
2011-04-28 06:01:08 +02:00
|
|
|
"""
|
2013-05-28 23:58:08 +02:00
|
|
|
Install a package with a setup.py that emits UTF-8 output and then fails.
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2013-05-28 23:58:08 +02:00
|
|
|
Refs https://github.com/pypa/pip/issues/326
|
2011-04-21 16:14:24 +02:00
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
to_install = data.packages.join("BrokenEmitsUTF8")
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', to_install, expect_error=True, expect_temp=True, quiet=True,
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
'FakeError: this package designed to fail on install' in result.stdout
|
|
|
|
)
|
2013-05-28 23:58:08 +02:00
|
|
|
assert 'UnicodeDecodeError' not in result.stdout
|
2011-04-26 14:35:17 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2013-12-01 05:38:41 +01:00
|
|
|
def test_install_package_with_utf8_setup(script, data):
|
|
|
|
"""Install a package with a setup.py that declares a utf-8 encoding."""
|
|
|
|
to_install = data.packages.join("SetupPyUTF8")
|
|
|
|
script.pip('install', to_install)
|
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2013-12-01 05:38:41 +01:00
|
|
|
def test_install_package_with_latin1_setup(script, data):
|
|
|
|
"""Install a package with a setup.py that declares a latin-1 encoding."""
|
|
|
|
to_install = data.packages.join("SetupPyLatin1")
|
|
|
|
script.pip('install', to_install)
|
2011-05-04 09:44:02 +02:00
|
|
|
|
2014-01-28 15:17:51 +01:00
|
|
|
|
2014-04-30 02:55:12 +02:00
|
|
|
def test_url_req_case_mismatch_no_index(script, data):
|
2011-04-26 14:35:17 +02:00
|
|
|
"""
|
2014-01-28 15:17:51 +01:00
|
|
|
tar ball url requirements (with no egg fragment), that happen to have upper
|
|
|
|
case project names, should be considered equal to later requirements that
|
|
|
|
reference the project name using lower case.
|
2011-04-26 14:35:17 +02:00
|
|
|
|
2013-05-28 23:58:08 +02:00
|
|
|
tests/packages contains Upper-1.0.tar.gz and Upper-2.0.tar.gz
|
|
|
|
'requiresupper' has install_requires = ['upper']
|
|
|
|
"""
|
2013-08-23 13:12:37 +02:00
|
|
|
Upper = os.path.join(data.find_links, 'Upper-1.0.tar.gz')
|
2014-01-28 15:17:51 +01:00
|
|
|
result = script.pip(
|
|
|
|
'install', '--no-index', '-f', data.find_links, Upper, 'requiresupper'
|
|
|
|
)
|
2011-04-28 07:53:48 +02:00
|
|
|
|
2014-03-26 23:24:19 +01:00
|
|
|
# only Upper-1.0.tar.gz should get installed.
|
2013-08-21 11:16:07 +02:00
|
|
|
egg_folder = script.site_packages / 'Upper-1.0-py%s.egg-info' % pyversion
|
2013-05-28 23:58:08 +02:00
|
|
|
assert egg_folder in result.files_created, str(result)
|
2013-08-21 11:16:07 +02:00
|
|
|
egg_folder = script.site_packages / 'Upper-2.0-py%s.egg-info' % pyversion
|
2013-05-28 23:58:08 +02:00
|
|
|
assert egg_folder not in result.files_created, str(result)
|
2013-11-22 03:59:31 +01:00
|
|
|
|
|
|
|
|
2014-04-30 02:55:12 +02:00
|
|
|
def test_url_req_case_mismatch_file_index(script, data):
|
|
|
|
"""
|
|
|
|
tar ball url requirements (with no egg fragment), that happen to have upper
|
|
|
|
case project names, should be considered equal to later requirements that
|
|
|
|
reference the project name using lower case.
|
|
|
|
|
|
|
|
tests/packages3 contains Dinner-1.0.tar.gz and Dinner-2.0.tar.gz
|
|
|
|
'requiredinner' has install_requires = ['dinner']
|
|
|
|
|
|
|
|
This test is similar to test_url_req_case_mismatch_no_index; that test
|
|
|
|
tests behaviour when using "--no-index -f", while this one does the same
|
|
|
|
test when using "--index-url". Unfortunately this requires a different
|
|
|
|
set of packages as it requires a prepared index.html file and
|
|
|
|
subdirectory-per-package structure.
|
|
|
|
"""
|
|
|
|
Dinner = os.path.join(data.find_links3, 'Dinner', 'Dinner-1.0.tar.gz')
|
|
|
|
result = script.pip(
|
|
|
|
'install', '--index-url', data.find_links3, Dinner, 'requiredinner'
|
|
|
|
)
|
|
|
|
|
|
|
|
# only Upper-1.0.tar.gz should get installed.
|
|
|
|
egg_folder = script.site_packages / 'Dinner-1.0-py%s.egg-info' % pyversion
|
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
egg_folder = script.site_packages / 'Dinner-2.0-py%s.egg-info' % pyversion
|
|
|
|
assert egg_folder not in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
|
|
|
def test_url_incorrect_case_no_index(script, data):
|
|
|
|
"""
|
|
|
|
Same as test_url_req_case_mismatch_no_index, except testing for the case
|
|
|
|
where the incorrect case is given in the name of the package to install
|
|
|
|
rather than in a requirements file.
|
|
|
|
"""
|
|
|
|
result = script.pip(
|
|
|
|
'install', '--no-index', '-f', data.find_links, "upper",
|
|
|
|
)
|
|
|
|
|
|
|
|
# only Upper-2.0.tar.gz should get installed.
|
|
|
|
egg_folder = script.site_packages / 'Upper-1.0-py%s.egg-info' % pyversion
|
|
|
|
assert egg_folder not in result.files_created, str(result)
|
|
|
|
egg_folder = script.site_packages / 'Upper-2.0-py%s.egg-info' % pyversion
|
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
|
|
|
def test_url_incorrect_case_file_index(script, data):
|
|
|
|
"""
|
|
|
|
Same as test_url_req_case_mismatch_file_index, except testing for the case
|
|
|
|
where the incorrect case is given in the name of the package to install
|
|
|
|
rather than in a requirements file.
|
|
|
|
"""
|
|
|
|
result = script.pip(
|
|
|
|
'install', '--index-url', data.find_links3, "dinner",
|
|
|
|
)
|
|
|
|
|
|
|
|
# only Upper-2.0.tar.gz should get installed.
|
|
|
|
egg_folder = script.site_packages / 'Dinner-1.0-py%s.egg-info' % pyversion
|
|
|
|
assert egg_folder not in result.files_created, str(result)
|
|
|
|
egg_folder = script.site_packages / 'Dinner-2.0-py%s.egg-info' % pyversion
|
|
|
|
assert egg_folder in result.files_created, str(result)
|
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-11-22 03:59:31 +01:00
|
|
|
def test_compiles_pyc(script):
|
|
|
|
"""
|
|
|
|
Test installing with --compile on
|
|
|
|
"""
|
|
|
|
del script.environ["PYTHONDONTWRITEBYTECODE"]
|
|
|
|
script.pip("install", "--compile", "--no-use-wheel", "INITools==0.2")
|
|
|
|
|
|
|
|
# There are many locations for the __init__.pyc file so attempt to find
|
|
|
|
# any of them
|
|
|
|
exists = [
|
2014-02-24 22:52:23 +01:00
|
|
|
os.path.exists(script.site_packages_path / "initools/__init__.pyc"),
|
2013-11-22 03:59:31 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
exists += glob.glob(
|
2014-02-24 22:52:23 +01:00
|
|
|
script.site_packages_path / "initools/__pycache__/__init__*.pyc"
|
2013-11-22 03:59:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
assert any(exists)
|
|
|
|
|
|
|
|
|
2015-01-15 00:53:15 +01:00
|
|
|
@pytest.mark.network
|
2013-11-22 03:59:31 +01:00
|
|
|
def test_no_compiles_pyc(script, data):
|
|
|
|
"""
|
|
|
|
Test installing from wheel with --compile on
|
|
|
|
"""
|
|
|
|
del script.environ["PYTHONDONTWRITEBYTECODE"]
|
|
|
|
script.pip("install", "--no-compile", "--no-use-wheel", "INITools==0.2")
|
|
|
|
|
|
|
|
# There are many locations for the __init__.pyc file so attempt to find
|
|
|
|
# any of them
|
|
|
|
exists = [
|
2014-02-24 22:52:23 +01:00
|
|
|
os.path.exists(script.site_packages_path / "initools/__init__.pyc"),
|
2013-11-22 03:59:31 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
exists += glob.glob(
|
2014-02-24 22:52:23 +01:00
|
|
|
script.site_packages_path / "initools/__pycache__/__init__*.pyc"
|
2013-11-22 03:59:31 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
assert not any(exists)
|