Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
ff1a7938
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
12 个月 前同步成功
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pip
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ff1a7938
编写于
6月 13, 2013
作者:
M
Marcus Smith
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test changes due to virtualenv not using distribute
上级
72f0ec94
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
30 addition
and
139 deletion
+30
-139
pip/commands/install.py
pip/commands/install.py
+0
-7
pip/commands/wheel.py
pip/commands/wheel.py
+2
-2
tests/functional/test_install_index.py
tests/functional/test_install_index.py
+1
-1
tests/functional/test_install_user.py
tests/functional/test_install_user.py
+4
-19
tests/functional/test_install_wheel.py
tests/functional/test_install_wheel.py
+6
-6
tests/functional/test_search.py
tests/functional/test_search.py
+3
-3
tests/functional/test_wheel.py
tests/functional/test_wheel.py
+6
-18
tests/lib/__init__.py
tests/lib/__init__.py
+8
-53
tests/lib/test_lib.py
tests/lib/test_lib.py
+0
-30
未找到文件。
pip/commands/install.py
浏览文件 @
ff1a7938
...
...
@@ -232,13 +232,6 @@ class InstallCommand(Command):
logger
.
warn
(
msg
)
return
# import setuptools
# if (options.use_user_site and
# requirement_set.has_editables and
# not getattr(setuptools, '_distribute', False)):
# raise InstallationError('--user --editable not supported with setuptools, use distribute')
try
:
if
not
options
.
no_download
:
requirement_set
.
prepare_files
(
finder
,
force_root_egg_info
=
self
.
bundle
,
bundle
=
self
.
bundle
)
...
...
pip/commands/wheel.py
浏览文件 @
ff1a7938
...
...
@@ -22,7 +22,7 @@ class WheelCommand(Command):
Wheel is a built-package format, and offers the advantage of not recompiling your software during every install.
For more details, see the wheel docs: http://wheel.readthedocs.org/en/latest.
Requirements: distribute>=0.6.34
(not setuptools)
, and wheel.
Requirements: distribute>=0.6.34
or setuptools>=0.7.2
, and wheel.
'pip wheel' uses the bdist_wheel setuptools extension from the wheel package to build individual wheels.
...
...
@@ -78,7 +78,7 @@ class WheelCommand(Command):
def
run
(
self
,
options
,
args
):
#
requirements: wheel, and distribute
#
confirm requirements
try
:
import
wheel.bdist_wheel
except
ImportError
:
...
...
tests/functional/test_install_index.py
浏览文件 @
ff1a7938
...
...
@@ -27,7 +27,7 @@ def test_find_links_requirements_file_relative_path():
e
=
reset_env
()
write_file
(
'test-req.txt'
,
textwrap
.
dedent
(
"""
--no-index
--find-links=../../../
../
data/packages/
--find-links=../../../data/packages/
parent==0.1
"""
))
result
=
run_pip
(
...
...
tests/functional/test_install_user.py
浏览文件 @
ff1a7938
...
...
@@ -38,26 +38,11 @@ class Tests_UserSite:
assert
'INITools'
==
project_name
,
"'%s' should be 'INITools'"
%
project_name
def
test_install_subversion_usersite_editable_with_setuptools_fails
(
self
):
"""
Test installing current directory ('.') into usersite using setuptools fails
"""
# We don't try to use setuptools for 3.X.
if
sys
.
version_info
>=
(
3
,):
raise
SkipTest
()
env
=
reset_env
(
use_distribute
=
False
,
system_site_packages
=
True
)
result
=
run_pip
(
'install'
,
'--user'
,
'-e'
,
'%s#egg=initools-dev'
%
local_checkout
(
'svn+http://svn.colorstudy.com/INITools/trunk'
),
expect_error
=
True
)
assert
'--user --editable not supported with setuptools, use distribute'
in
result
.
stdout
def
test_install_subversion_usersite_editable_with_distribute
(
self
):
"""
Test installing current directory ('.') into usersite after installing distribute
"""
env
=
reset_env
(
use_distribute
=
True
,
system_site_packages
=
True
)
env
=
reset_env
(
system_site_packages
=
True
)
result
=
run_pip
(
'install'
,
'--user'
,
'-e'
,
'%s#egg=initools-dev'
%
local_checkout
(
'svn+http://svn.colorstudy.com/INITools/trunk'
))
...
...
@@ -68,7 +53,7 @@ class Tests_UserSite:
"""
Test installing current directory ('.') into usersite
"""
env
=
reset_env
(
use_distribute
=
True
,
system_site_packages
=
True
)
env
=
reset_env
(
system_site_packages
=
True
)
run_from
=
abspath
(
join
(
tests_data
,
'packages'
,
'FSPkg'
))
result
=
run_pip
(
'install'
,
'--user'
,
curdir
,
cwd
=
run_from
,
expect_error
=
False
)
fspkg_folder
=
env
.
user_site
/
'fspkg'
...
...
@@ -225,7 +210,7 @@ class Tests_UserSite:
"""
Test uninstall editable local user install
"""
env
=
reset_env
(
use_distribute
=
True
,
system_site_packages
=
True
)
env
=
reset_env
(,
system_site_packages
=
True
)
#install
to_install
=
abspath
(
join
(
tests_data
,
'packages'
,
'FSPkg'
))
...
...
@@ -245,7 +230,7 @@ class Tests_UserSite:
"""
Test user install from wheel
"""
env
=
reset_env
(
system_site_packages
=
True
,
use_distribute
=
True
)
env
=
reset_env
(
system_site_packages
=
True
)
pip_install_local
(
'wheel'
)
result
=
run_pip
(
'install'
,
'simple.dist==0.1'
,
'--user'
,
'--use-wheel'
,
'--no-index'
,
'--find-links='
+
find_links
)
...
...
tests/functional/test_install_wheel.py
浏览文件 @
ff1a7938
...
...
@@ -9,7 +9,7 @@ def test_install_from_wheel():
"""
Test installing from a wheel.
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
result
=
run_pip
(
'install'
,
'simple.dist'
,
'--use-wheel'
,
'--no-index'
,
'--find-links='
+
find_links
,
expect_error
=
False
)
...
...
@@ -27,7 +27,7 @@ def test_install_from_wheel_with_extras():
import
ast
except
ImportError
:
raise
SkipTest
(
"Need ast module to interpret wheel extras"
)
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
result
=
run_pip
(
'install'
,
'complex-dist[simple]'
,
'--use-wheel'
,
'--no-index'
,
'--find-links='
+
find_links
,
expect_error
=
False
)
...
...
@@ -45,7 +45,7 @@ def test_install_from_wheel_file():
"""
Test installing directly from a wheel file.
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
package
=
abspath
(
join
(
tests_data
,
'packages'
,
'headers.dist-0.1-py2.py3-none-any.whl'
))
...
...
@@ -60,7 +60,7 @@ def test_install_wheel_with_target():
"""
Test installing a wheel using pip install --target
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
pip_install_local
(
'wheel'
)
target_dir
=
env
.
scratch_path
/
'target'
result
=
run_pip
(
'install'
,
'simple.dist==0.1'
,
'-t'
,
target_dir
,
'--use-wheel'
,
...
...
@@ -73,7 +73,7 @@ def test_install_from_wheel_installs_deps():
Test can install dependencies of wheels
"""
# 'requires_source' depends on the 'source' project
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
package
=
abspath
(
join
(
tests_data
,
'packages'
,
'requires_source-1.0-py2.py3-none-any.whl'
))
...
...
@@ -86,7 +86,7 @@ def test_install_from_wheel_no_deps():
Test --no-deps works with wheel installs
"""
# 'requires_source' depends on the 'source' project
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
package
=
abspath
(
join
(
tests_data
,
'packages'
,
'requires_source-1.0-py2.py3-none-any.whl'
))
...
...
tests/functional/test_search.py
浏览文件 @
ff1a7938
...
...
@@ -80,7 +80,7 @@ def test_search_missing_argument():
"""
Test missing required argument for search
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
result
=
run_pip
(
'search'
,
expect_error
=
True
)
assert
'ERROR: Missing required argument (search query).'
in
result
.
stdout
...
...
@@ -111,7 +111,7 @@ def test_search_should_exit_status_code_zero_when_find_packages():
"""
Test search exit status code for package found
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
result
=
run_pip
(
'search'
,
'pip'
)
assert
result
.
returncode
==
SUCCESS
...
...
@@ -120,6 +120,6 @@ def test_search_exit_status_code_when_finds_no_package():
"""
Test search exit status code for no matches
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
result
=
run_pip
(
'search'
,
'non-existant-package'
,
expect_error
=
True
)
assert
result
.
returncode
==
NO_MATCHES_FOUND
,
result
.
returncode
tests/functional/test_wheel.py
浏览文件 @
ff1a7938
...
...
@@ -14,27 +14,15 @@ def test_pip_wheel_fails_without_wheel():
"""
Test 'pip wheel' fails without wheel
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
result
=
run_pip
(
'wheel'
,
'--no-index'
,
'-f'
,
find_links
,
'simple==3.0'
,
expect_error
=
True
)
assert
"'pip wheel' requires bdist_wheel"
in
result
.
stdout
def
test_pip_wheel_setuptools_fails
():
"""
Test 'pip wheel' fails with setuptools
"""
if
sys
.
version_info
>=
(
3
,
0
):
# virtualenv installs distribute in py3
raise
SkipTest
()
env
=
reset_env
(
use_distribute
=
False
)
pip_install_local
(
'wheel'
)
result
=
run_pip
(
'wheel'
,
'--no-index'
,
'-f'
,
find_links
,
'simple==3.0'
,
expect_error
=
True
)
assert
"'pip wheel' requires %s"
%
wheel
.
distribute_requirement
in
result
.
stdout
,
result
.
stdout
def
test_pip_wheel_success
():
"""
Test 'pip wheel' success.
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
pip_install_local
(
'wheel'
)
result
=
run_pip
(
'wheel'
,
'--no-index'
,
'-f'
,
find_links
,
'simple==3.0'
)
wheel_file_name
=
'simple-3.0-py%s-none-any.whl'
%
pyversion_nodot
...
...
@@ -47,7 +35,7 @@ def test_pip_wheel_fail():
"""
Test 'pip wheel' failure.
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
pip_install_local
(
'wheel'
)
result
=
run_pip
(
'wheel'
,
'--no-index'
,
'-f'
,
find_links
,
'wheelbroken==0.1'
)
wheel_file_name
=
'wheelbroken-0.1-py%s-none-any.whl'
%
pyversion_nodot
...
...
@@ -61,7 +49,7 @@ def test_pip_wheel_ignore_wheels_editables():
"""
Test 'pip wheel' ignores editables and *.whl files in requirements
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
pip_install_local
(
'wheel'
)
local_wheel
=
'%s/simple.dist-0.1-py2.py3-none-any.whl'
%
find_links
...
...
@@ -89,7 +77,7 @@ def test_no_clean_option_blocks_cleaning_after_wheel():
"""
Test --no-clean option blocks cleaning after wheel build
"""
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
pip_install_local
(
'wheel'
)
result
=
run_pip
(
'wheel'
,
'--no-clean'
,
'--no-index'
,
'--find-links=%s'
%
find_links
,
'simple'
)
build
=
env
.
venv_path
/
'build'
/
'simple'
...
...
@@ -101,7 +89,7 @@ def test_pip_wheel_source_deps():
Test 'pip wheel --use-wheel' finds and builds source archive dependencies of wheels
"""
# 'requires_source' is a wheel that depends on the 'source' project
env
=
reset_env
(
use_distribute
=
True
)
env
=
reset_env
()
pip_install_local
(
'wheel'
)
result
=
run_pip
(
'wheel'
,
'--use-wheel'
,
'--no-index'
,
'-f'
,
find_links
,
'requires_source'
)
wheel_file_name
=
'source-1.0-py%s-none-any.whl'
%
pyversion_nodot
...
...
tests/lib/__init__.py
浏览文件 @
ff1a7938
...
...
@@ -55,12 +55,10 @@ def demand_dirs(path):
sys
.
path
=
[
src_folder
]
+
sys
.
path
def
create_virtualenv
(
where
,
distribute
=
False
):
def
create_virtualenv
(
where
):
import
virtualenv
if
sys
.
version_info
[
0
]
>
2
:
distribute
=
True
virtualenv
.
create_environment
(
where
,
u
se_distribute
=
distribute
,
u
nzip_setuptools
=
True
)
where
,
unzip_setuptools
=
True
)
return
virtualenv
.
path_locations
(
where
)
...
...
@@ -90,26 +88,9 @@ def clear_environ(environ):
return
dict
(((
k
,
v
)
for
k
,
v
in
environ
.
items
()
if
not
k
.
lower
().
startswith
(
'pip_'
)))
def
install_setuptools
(
env
):
easy_install
=
os
.
path
.
join
(
env
.
bin_path
,
'easy_install'
)
version
=
'setuptools==0.6c11'
if
sys
.
platform
!=
'win32'
:
return
env
.
run
(
easy_install
,
version
)
tempdir
=
tempfile
.
mkdtemp
()
try
:
for
f
in
glob
.
glob
(
easy_install
+
'*'
):
shutil
.
copy2
(
f
,
tempdir
)
return
env
.
run
(
os
.
path
.
join
(
tempdir
,
'easy_install'
),
version
)
finally
:
rmtree
(
tempdir
)
env
=
None
def
reset_env
(
environ
=
None
,
use_distribute
=
False
,
system_site_packages
=
False
,
sitecustomize
=
None
,
insecure
=
True
):
...
...
@@ -117,24 +98,15 @@ def reset_env(environ=None,
Keyword arguments:
environ: an environ object to use.
use_distribute: use distribute, not setuptools.
system_site_packages: create a virtualenv that simulates --system-site-packages.
sitecustomize: a string containing python code to add to sitecustomize.py.
insecure: how to set the --insecure option for py25 tests.
"""
if
sys
.
version_info
>=
(
3
,):
use_distribute
=
True
global
env
if
use_distribute
:
test_class
=
TestPipEnvironmentD
else
:
test_class
=
TestPipEnvironment
env
=
test_class
(
environ
,
sitecustomize
=
sitecustomize
)
test_class
.
rebuild_venv
=
False
env
=
TestPipEnvironment
(
environ
,
sitecustomize
=
sitecustomize
)
TestPipEnvironment
.
rebuild_venv
=
False
if
system_site_packages
:
#testing often occurs starting from a private virtualenv (e.g. with tox)
...
...
@@ -142,7 +114,7 @@ def reset_env(environ=None,
#to create a 'system-site-packages' virtualenv
#hence, this workaround
(
env
.
lib_path
/
'no-global-site-packages.txt'
).
rm
()
test_class
.
rebuild_venv
=
True
TestPipEnvironment
.
rebuild_venv
=
True
return
env
...
...
@@ -303,16 +275,13 @@ class TestPipEnvironment(TestFileEnvironment):
exe
=
sys
.
platform
==
'win32'
and
'.exe'
or
''
verbose
=
False
use_distribute
=
False
# Keep short to undercut windows path length issues
setuptools
=
's'
rebuild_venv
=
True
def
__init__
(
self
,
environ
=
None
,
sitecustomize
=
None
):
import
virtualenv
self
.
root_path
=
fast_test_env_root
/
self
.
setuptools
self
.
backup_path
=
fast_test_env_backup
/
self
.
setuptools
self
.
root_path
=
fast_test_env_root
self
.
backup_path
=
fast_test_env_backup
self
.
scratch_path
=
self
.
root_path
/
self
.
scratch
...
...
@@ -366,7 +335,7 @@ class TestPipEnvironment(TestFileEnvironment):
demand_dirs
(
self
.
scratch_path
)
# Create a virtualenv and remember where it's putting things.
create_virtualenv
(
self
.
venv_path
,
distribute
=
self
.
use_distribute
)
create_virtualenv
(
self
.
venv_path
)
demand_dirs
(
self
.
user_site_path
)
...
...
@@ -382,10 +351,6 @@ class TestPipEnvironment(TestFileEnvironment):
"Oops! 'python' in our test environment runs %r"
" rather than expected %r"
%
(
pythonbin
,
self
.
bin_path
/
'python'
))
# make sure we have current setuptools to avoid svn incompatibilities
if
not
self
.
use_distribute
:
install_setuptools
(
self
)
# Uninstall whatever version of pip came with the virtualenv.
# Earlier versions of pip were incapable of
# self-uninstallation on Windows, so we use the one we're testing.
...
...
@@ -469,16 +434,6 @@ class TestPipEnvironment(TestFileEnvironment):
os
.
remove
(
cache_path
)
class
TestPipEnvironmentD
(
TestPipEnvironment
):
"""A specialized TestFileEnvironment that contains distribute"""
use_distribute
=
True
# Keep short to undercut windows path length issues
setuptools
=
'd'
rebuild_venv
=
True
def
run_pip
(
*
args
,
**
kw
):
result
=
env
.
run
(
'pip'
,
*
args
,
**
kw
)
ignore
=
[]
...
...
tests/lib/test_lib.py
浏览文件 @
ff1a7938
...
...
@@ -44,17 +44,9 @@ class Test_reset_env:
f
=
open
(
self
.
test_file
,
'w'
)
f
.
close
()
# create a TestPipEnvironmentD env and add a file to the backup
self
.
envD
=
reset_env
(
use_distribute
=
True
)
self
.
test_fileD
=
self
.
envD
.
backup_path
/
self
.
envD
.
venv
/
'test_fileD'
f
=
open
(
self
.
test_fileD
,
'w'
)
f
.
close
()
def
teardown
(
self
):
if
os
.
path
.
isfile
(
self
.
test_file
):
self
.
test_file
.
rm
()
if
os
.
path
.
isfile
(
self
.
test_fileD
):
self
.
test_fileD
.
rm
()
def
test_cache_venv
(
self
):
"""
...
...
@@ -62,18 +54,7 @@ class Test_reset_env:
"""
env
=
reset_env
()
assert
os
.
path
.
isfile
(
self
.
test_file
)
env
=
reset_env
(
use_distribute
=
True
)
assert
os
.
path
.
isfile
(
self
.
test_fileD
)
def
test_reset_env_seperate
(
self
):
"""
Test TestPipEnvironment and TestPipEnvironmentD classes maintain seperate caches in py2
"""
# skip for py3 because both classes use the distribute cache
if
sys
.
version_info
>
(
3
,
0
):
raise
SkipTest
()
assert
not
os
.
path
.
isfile
(
self
.
env
.
backup_path
/
self
.
env
.
venv
/
'test_fileD'
)
assert
not
os
.
path
.
isfile
(
self
.
envD
.
backup_path
/
self
.
envD
.
venv
/
'test_file'
)
def
test_reset_env_system_site_packages
(
self
):
"""
...
...
@@ -127,17 +108,6 @@ def test_sitecustomize_not_growing_in_fast_environment():
def
test_tmp_dir_exists_in_env
():
"""
Test that $TMPDIR == env.temp_path and path exists, and env.assert_no_temp() passes
"""
#need these tests to ensure the assert_no_temp feature of scripttest is working
env
=
reset_env
(
use_distribute
=
True
)
env
.
assert_no_temp
()
#this fails if env.tmp_path doesn't exist
assert
env
.
environ
[
'TMPDIR'
]
==
env
.
temp_path
assert
isdir
(
env
.
temp_path
)
def
test_tmp_dir_exists_in_fast_env
():
"""
Test that $TMPDIR == env.temp_path and path exists and env.assert_no_temp() passes (in fast env)
"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录