Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
b709b1ef
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,发现更多精彩内容 >>
提交
b709b1ef
编写于
5月 14, 2017
作者:
X
Xavier Fernandez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add a common_wheels fixtures providing wheel & setuptools wheels
上级
3dd4a0d1
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
119 addition
and
89 deletion
+119
-89
tests/conftest.py
tests/conftest.py
+13
-0
tests/functional/test_install.py
tests/functional/test_install.py
+45
-34
tests/functional/test_install_config.py
tests/functional/test_install_config.py
+3
-2
tests/functional/test_install_reqs.py
tests/functional/test_install_reqs.py
+11
-9
tests/functional/test_install_wheel.py
tests/functional/test_install_wheel.py
+6
-6
tests/functional/test_wheel.py
tests/functional/test_wheel.py
+41
-38
未找到文件。
tests/conftest.py
浏览文件 @
b709b1ef
import
io
import
os
import
shutil
import
subprocess
import
sys
import
pytest
...
...
@@ -191,6 +192,18 @@ def script(tmpdir, virtualenv):
)
@
pytest
.
fixture
(
scope
=
"session"
)
def
common_wheels
(
tmpdir_factory
):
"""Provide a directory with latest setuptools and wheel wheels"""
wheels_dir
=
tmpdir_factory
.
mktemp
(
'common_wheels'
)
subprocess
.
check_call
([
'pip'
,
'download'
,
'wheel'
,
'setuptools'
,
'-d'
,
str
(
wheels_dir
),
])
yield
wheels_dir
wheels_dir
.
remove
(
ignore_errors
=
True
)
@
pytest
.
fixture
def
data
(
tmpdir
):
return
TestData
.
copy
(
tmpdir
.
join
(
"data"
))
...
...
tests/functional/test_install.py
浏览文件 @
b709b1ef
...
...
@@ -146,10 +146,8 @@ def test_install_editable_from_svn(script):
result
.
assert_installed
(
'version-pkg'
,
with_files
=
[
'.svn'
])
def
_test_install_editable_from_git
(
script
,
tmpdir
,
wheel
):
def
_test_install_editable_from_git
(
script
,
tmpdir
):
"""Test cloning from Git."""
if
wheel
:
script
.
pip
(
'install'
,
'wheel'
)
pkg_path
=
_create_test_package
(
script
,
name
=
'testpackage'
,
vcs
=
'git'
)
args
=
[
'install'
,
'-e'
,
'git+%s#egg=testpackage'
%
path_to_url
(
pkg_path
)]
result
=
script
.
pip
(
*
args
,
**
{
"expect_error"
:
True
})
...
...
@@ -157,12 +155,14 @@ def _test_install_editable_from_git(script, tmpdir, wheel):
def
test_install_editable_from_git
(
script
,
tmpdir
):
_test_install_editable_from_git
(
script
,
tmpdir
,
False
)
_test_install_editable_from_git
(
script
,
tmpdir
)
@
pytest
.
mark
.
network
def
test_install_editable_from_git_autobuild_wheel
(
script
,
tmpdir
):
_test_install_editable_from_git
(
script
,
tmpdir
,
True
)
def
test_install_editable_from_git_autobuild_wheel
(
script
,
tmpdir
,
common_wheels
):
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
_test_install_editable_from_git
(
script
,
tmpdir
)
@
pytest
.
mark
.
network
...
...
@@ -936,21 +936,21 @@ def test_install_topological_sort(script, data):
@
pytest
.
mark
.
network
def
test_install_wheel_broken
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
def
test_install_wheel_broken
(
script
,
data
,
common_wheels
):
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
res
=
script
.
pip
(
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'wheelbroken'
,
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'wheelbroken'
,
expect_stderr
=
True
)
assert
"Successfully installed wheelbroken-0.1"
in
str
(
res
),
str
(
res
)
@
pytest
.
mark
.
network
def
test_cleanup_after_failed_wheel
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
def
test_cleanup_after_failed_wheel
(
script
,
data
,
common_wheels
):
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
res
=
script
.
pip
(
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'wheelbrokenafter'
,
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'wheelbrokenafter'
,
expect_stderr
=
True
)
# One of the effects of not cleaning up is broken scripts:
script_py
=
script
.
bin_path
/
"script.py"
...
...
@@ -962,15 +962,14 @@ def test_cleanup_after_failed_wheel(script, data):
@
pytest
.
mark
.
network
def
test_install_builds_wheels
(
script
,
data
):
def
test_install_builds_wheels
(
script
,
data
,
common_wheels
):
# NB This incidentally tests a local tree + tarball inputs
# see test_install_editable_from_git_autobuild_wheel for editable
# vcs coverage.
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
to_install
=
data
.
packages
.
join
(
'requires_wheelbroken_upper'
)
res
=
script
.
pip
(
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
to_install
,
expect_stderr
=
True
)
expected
=
(
"Successfully installed requires-wheelbroken-upper-0"
" upper-2.0 wheelbroken-0.1"
)
...
...
@@ -1002,12 +1001,13 @@ def test_install_builds_wheels(script, data):
@
pytest
.
mark
.
network
def
test_install_no_binary_disables_building_wheels
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'
download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
package
s
)
def
test_install_no_binary_disables_building_wheels
(
script
,
data
,
common_wheels
):
script
.
pip
(
'
install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheel
s
)
to_install
=
data
.
packages
.
join
(
'requires_wheelbroken_upper'
)
res
=
script
.
pip
(
'install'
,
'--no-index'
,
'--no-binary=upper'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
to_install
,
expect_stderr
=
True
)
expected
=
(
"Successfully installed requires-wheelbroken-upper-0"
" upper-2.0 wheelbroken-0.1"
)
...
...
@@ -1035,12 +1035,11 @@ def test_install_no_binary_disables_building_wheels(script, data):
@
pytest
.
mark
.
network
def
test_install_no_binary_disables_cached_wheels
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
def
test_install_no_binary_disables_cached_wheels
(
script
,
data
,
common_wheels
):
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
# Seed the cache
script
.
pip
(
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'install'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'upper'
)
script
.
pip
(
'uninstall'
,
'upper'
,
'-y'
)
res
=
script
.
pip
(
...
...
@@ -1107,7 +1106,7 @@ def test_double_install_fail(script, data):
assert
msg
in
result
.
stderr
def
test_install_incompatible_python_requires
(
script
):
def
test_install_incompatible_python_requires
(
script
,
common_wheels
):
script
.
scratch_path
.
join
(
"pkga"
).
mkdir
()
pkga_path
=
script
.
scratch_path
/
'pkga'
pkga_path
.
join
(
"setup.py"
).
write
(
textwrap
.
dedent
(
"""
...
...
@@ -1116,13 +1115,16 @@ def test_install_incompatible_python_requires(script):
python_requires='<1.0',
version='0.1')
"""
))
script
.
pip
(
'install'
,
'setuptools>24.2'
)
# This should not be needed
script
.
pip
(
'install'
,
'setuptools>24.2'
,
# This should not be needed
'--no-index'
,
'-f'
,
common_wheels
,
)
result
=
script
.
pip
(
'install'
,
pkga_path
,
expect_error
=
True
)
assert
(
"pkga requires Python '<1.0' "
"but the running Python is "
)
in
result
.
stderr
def
test_install_incompatible_python_requires_editable
(
script
):
def
test_install_incompatible_python_requires_editable
(
script
,
common_wheels
):
script
.
scratch_path
.
join
(
"pkga"
).
mkdir
()
pkga_path
=
script
.
scratch_path
/
'pkga'
pkga_path
.
join
(
"setup.py"
).
write
(
textwrap
.
dedent
(
"""
...
...
@@ -1131,7 +1133,10 @@ def test_install_incompatible_python_requires_editable(script):
python_requires='<1.0',
version='0.1')
"""
))
script
.
pip
(
'install'
,
'setuptools>24.2'
)
# This should not be needed
script
.
pip
(
'install'
,
'setuptools>24.2'
,
# This should not be needed
'--no-index'
,
'-f'
,
common_wheels
,
)
result
=
script
.
pip
(
'install'
,
'--editable=%s'
%
pkga_path
,
expect_error
=
True
)
assert
(
"pkga requires Python '<1.0' "
...
...
@@ -1139,7 +1144,7 @@ def test_install_incompatible_python_requires_editable(script):
@
pytest
.
mark
.
network
def
test_install_incompatible_python_requires_wheel
(
script
):
def
test_install_incompatible_python_requires_wheel
(
script
,
common_wheels
):
script
.
scratch_path
.
join
(
"pkga"
).
mkdir
()
pkga_path
=
script
.
scratch_path
/
'pkga'
pkga_path
.
join
(
"setup.py"
).
write
(
textwrap
.
dedent
(
"""
...
...
@@ -1148,8 +1153,11 @@ def test_install_incompatible_python_requires_wheel(script):
python_requires='<1.0',
version='0.1')
"""
))
script
.
pip
(
'install'
,
'setuptools>24.2'
)
# This should not be needed
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'setuptools>24.2'
,
# This should not be needed
'--no-index'
,
'-f'
,
common_wheels
,
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
script
.
run
(
'python'
,
'setup.py'
,
'bdist_wheel'
,
'--universal'
,
cwd
=
pkga_path
)
result
=
script
.
pip
(
'install'
,
'./pkga/dist/pkga-0.1-py2.py3-none-any.whl'
,
...
...
@@ -1158,7 +1166,7 @@ def test_install_incompatible_python_requires_wheel(script):
"but the running Python is "
)
in
result
.
stderr
def
test_install_compatible_python_requires
(
script
):
def
test_install_compatible_python_requires
(
script
,
common_wheels
):
script
.
scratch_path
.
join
(
"pkga"
).
mkdir
()
pkga_path
=
script
.
scratch_path
/
'pkga'
pkga_path
.
join
(
"setup.py"
).
write
(
textwrap
.
dedent
(
"""
...
...
@@ -1167,7 +1175,10 @@ def test_install_compatible_python_requires(script):
python_requires='>1.0',
version='0.1')
"""
))
script
.
pip
(
'install'
,
'setuptools>24.2'
)
# This should not be needed
script
.
pip
(
'install'
,
'setuptools>24.2'
,
# This should not be needed
'--no-index'
,
'-f'
,
common_wheels
,
)
res
=
script
.
pip
(
'install'
,
pkga_path
,
expect_error
=
True
)
assert
"Successfully installed pkga-0.1"
in
res
.
stdout
,
res
...
...
tests/functional/test_install_config.py
浏览文件 @
b709b1ef
...
...
@@ -200,8 +200,9 @@ def test_options_from_venv_config(script, virtualenv):
@
pytest
.
mark
.
network
def
test_install_no_binary_via_config_disables_cached_wheels
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
def
test_install_no_binary_via_config_disables_cached_wheels
(
script
,
data
,
common_wheels
):
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
config_file
=
tempfile
.
NamedTemporaryFile
(
mode
=
'wt'
)
script
.
environ
[
'PIP_CONFIG_FILE'
]
=
config_file
.
name
config_file
.
write
(
textwrap
.
dedent
(
"""
\
...
...
tests/functional/test_install_reqs.py
浏览文件 @
b709b1ef
...
...
@@ -223,10 +223,10 @@ def test_install_local_with_subdirectory(script):
@
pytest
.
mark
.
network
def
test_wheel_user_with_prefix_in_pydistutils_cfg
(
script
,
data
,
virtualenv
):
def
test_wheel_user_with_prefix_in_pydistutils_cfg
(
script
,
data
,
virtualenv
,
common_wheels
):
# Make sure wheel is available in the virtualenv
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
virtualenv
.
system_site_packages
=
True
homedir
=
script
.
environ
[
"HOME"
]
script
.
scratch_path
.
join
(
"bin"
).
mkdir
()
...
...
@@ -235,8 +235,10 @@ def test_wheel_user_with_prefix_in_pydistutils_cfg(script, data, virtualenv):
[install]
prefix=%s"""
%
script
.
scratch_path
))
result
=
script
.
pip
(
'install'
,
'--user'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'requiresupper'
)
result
=
script
.
pip
(
'install'
,
'--user'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'requiresupper'
)
# Check that we are really installing a wheel
assert
'Running setup.py install for requiresupper'
not
in
result
.
stdout
assert
'installed requiresupper'
in
result
.
stdout
...
...
@@ -339,7 +341,7 @@ def test_constrained_to_url_install_same_url(script, data):
@
pytest
.
mark
.
network
def
test_double_install_spurious_hash_mismatch
(
script
,
tmpdir
,
data
):
def
test_double_install_spurious_hash_mismatch
(
script
,
tmpdir
,
common_wheels
):
"""Make sure installing the same hashed sdist twice doesn't throw hash
mismatch errors.
...
...
@@ -349,14 +351,14 @@ def test_double_install_spurious_hash_mismatch(script, tmpdir, data):
causes spurious mismatch errors.
"""
script
.
pip
(
'install'
,
'wheel'
)
# O
therwise, it won't try to build wheels.
script
.
pip
(
'
download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
package
s
)
# Install wheel package, o
therwise, it won't try to build wheels.
script
.
pip
(
'
install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheel
s
)
with
requirements_file
(
'simple==1.0 --hash=sha256:393043e672415891885c9a2a'
'0929b1af95fb866d6ca016b42d2e6ce53619b653'
,
tmpdir
)
as
reqs_file
:
# Install a package (and build its wheel):
result
=
script
.
pip_install_local
(
'--find-links'
,
data
.
find_links
,
'--find-links'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'-r'
,
reqs_file
.
abspath
,
expect_error
=
False
)
assert
'Successfully installed simple-1.0'
in
str
(
result
)
...
...
tests/functional/test_install_wheel.py
浏览文件 @
b709b1ef
...
...
@@ -115,11 +115,11 @@ def test_install_from_wheel_with_headers(script, data):
@
pytest
.
mark
.
network
def
test_install_wheel_with_target
(
script
,
data
):
def
test_install_wheel_with_target
(
script
,
data
,
common_wheels
):
"""
Test installing a wheel using pip install --target
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
target_dir
=
script
.
scratch_path
/
'target'
result
=
script
.
pip
(
'install'
,
'simple.dist==0.1'
,
'-t'
,
target_dir
,
...
...
@@ -131,7 +131,7 @@ def test_install_wheel_with_target(script, data):
@
pytest
.
mark
.
network
def
test_install_wheel_with_target_and_data_files
(
script
,
data
):
def
test_install_wheel_with_target_and_data_files
(
script
,
data
,
common_wheels
):
"""
Test for issue #4092. It will be checked that a data_files specification in
setup.py is handled correctly when a wheel is installed with the --target
...
...
@@ -150,7 +150,7 @@ def test_install_wheel_with_target_and_data_files(script, data):
]
)
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
target_dir
=
script
.
scratch_path
/
'prjwithdatafile'
package
=
data
.
packages
.
join
(
"prjwithdatafile-1.0-py2.py3-none-any.whl"
)
result
=
script
.
pip
(
'install'
,
package
,
...
...
@@ -221,12 +221,12 @@ def test_install_from_wheel_no_deps(script, data):
@
pytest
.
mark
.
network
def
test_install_user_wheel
(
script
,
virtualenv
,
data
):
def
test_install_user_wheel
(
script
,
virtualenv
,
data
,
common_wheels
):
"""
Test user install from wheel (that has a script)
"""
virtualenv
.
system_site_packages
=
True
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
result
=
script
.
pip
(
'install'
,
'has.script==1.0'
,
'--user'
,
'--no-index'
,
'--find-links='
+
data
.
find_links
,
...
...
tests/functional/test_wheel.py
浏览文件 @
b709b1ef
...
...
@@ -20,34 +20,35 @@ def test_pip_wheel_fails_without_wheel(script, data):
assert
"'pip wheel' requires the 'wheel' package"
in
result
.
stderr
def
test_wheel_exit_status_code_when_no_requirements
(
script
):
def
test_wheel_exit_status_code_when_no_requirements
(
script
,
common_wheels
):
"""
Test wheel exit status code when no requirements specified
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
result
=
script
.
pip
(
'wheel'
,
expect_error
=
True
)
assert
"You must give at least one requirement to wheel"
in
result
.
stderr
assert
result
.
returncode
==
ERROR
def
test_wheel_exit_status_code_when_blank_requirements_file
(
script
):
def
test_wheel_exit_status_code_when_blank_requirements_file
(
script
,
common_wheels
):
"""
Test wheel exit status code when blank requirements file specified
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
script
.
scratch_path
.
join
(
"blank.txt"
).
write
(
"
\n
"
)
script
.
pip
(
'wheel'
,
'-r'
,
'blank.txt'
)
@
pytest
.
mark
.
network
def
test_pip_wheel_success
(
script
,
data
):
def
test_pip_wheel_success
(
script
,
data
,
common_wheels
):
"""
Test 'pip wheel' success.
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'simple==3.0'
,
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'simple==3.0'
,
)
wheel_file_name
=
'simple-3.0-py%s-none-any.whl'
%
pyversion
[
0
]
wheel_file_path
=
script
.
scratch
/
wheel_file_name
...
...
@@ -56,11 +57,11 @@ def test_pip_wheel_success(script, data):
@
pytest
.
mark
.
network
def
test_pip_wheel_downloads_wheels
(
script
,
data
):
def
test_pip_wheel_downloads_wheels
(
script
,
data
,
common_wheels
):
"""
Test 'pip wheel' downloads wheels
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'simple.dist'
,
)
...
...
@@ -71,27 +72,27 @@ def test_pip_wheel_downloads_wheels(script, data):
@
pytest
.
mark
.
network
def
test_pip_wheel_builds_when_no_binary_set
(
script
,
data
):
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
def
test_pip_wheel_builds_when_no_binary_set
(
script
,
data
,
common_wheels
):
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
data
.
packages
.
join
(
'simple-3.0-py2.py3-none-any.whl'
).
touch
()
# Check that the wheel package is ignored
res
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'--no-binary'
,
':all:'
,
'-f'
,
data
.
find_links
,
'wheel'
,
'--no-index'
,
'--no-binary'
,
':all:'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'simple==3.0'
)
assert
"Running setup.py bdist_wheel for simple"
in
str
(
res
),
str
(
res
)
@
pytest
.
mark
.
network
def
test_pip_wheel_builds_editable_deps
(
script
,
data
):
def
test_pip_wheel_builds_editable_deps
(
script
,
data
,
common_wheels
):
"""
Test 'pip wheel' finds and builds dependencies of editables
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
editable_path
=
os
.
path
.
join
(
data
.
src
,
'requires_simple'
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-e'
,
editable_path
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'-e'
,
editable_path
)
wheel_file_name
=
'simple-1.0-py%s-none-any.whl'
%
pyversion
[
0
]
wheel_file_path
=
script
.
scratch
/
wheel_file_name
...
...
@@ -99,15 +100,15 @@ def test_pip_wheel_builds_editable_deps(script, data):
@
pytest
.
mark
.
network
def
test_pip_wheel_builds_editable
(
script
,
data
):
def
test_pip_wheel_builds_editable
(
script
,
data
,
common_wheels
):
"""
Test 'pip wheel' builds an editable package
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
editable_path
=
os
.
path
.
join
(
data
.
src
,
'simplewheel-1.0'
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-e'
,
editable_path
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'-e'
,
editable_path
)
wheel_file_name
=
'simplewheel-1.0-py%s-none-any.whl'
%
pyversion
[
0
]
wheel_file_path
=
script
.
scratch
/
wheel_file_name
...
...
@@ -115,14 +116,14 @@ def test_pip_wheel_builds_editable(script, data):
@
pytest
.
mark
.
network
def
test_pip_wheel_fail
(
script
,
data
):
def
test_pip_wheel_fail
(
script
,
data
,
common_wheels
):
"""
Test 'pip wheel' failure.
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'wheelbroken==0.1'
,
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'wheelbroken==0.1'
,
expect_error
=
True
,
)
wheel_file_name
=
'wheelbroken-0.1-py%s-none-any.whl'
%
pyversion
[
0
]
...
...
@@ -137,16 +138,17 @@ def test_pip_wheel_fail(script, data):
@
pytest
.
mark
.
network
def
test_no_clean_option_blocks_cleaning_after_wheel
(
script
,
data
):
def
test_no_clean_option_blocks_cleaning_after_wheel
(
script
,
data
,
common_wheels
):
"""
Test --no-clean option blocks cleaning after wheel build
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
build
=
script
.
venv_path
/
'build'
result
=
script
.
pip
(
'wheel'
,
'--no-clean'
,
'--no-index'
,
'--build'
,
build
,
'--find-links=%s'
%
data
.
find_links
,
'simple'
,
'--find-links=%s'
%
data
.
find_links
,
'-f'
,
common_wheels
,
'simple'
,
expect_temp
=
True
,
)
build
=
build
/
'simple'
...
...
@@ -154,16 +156,16 @@ def test_no_clean_option_blocks_cleaning_after_wheel(script, data):
@
pytest
.
mark
.
network
def
test_pip_wheel_source_deps
(
script
,
data
):
def
test_pip_wheel_source_deps
(
script
,
data
,
common_wheels
):
"""
Test 'pip wheel' finds and builds source archive dependencies
of wheels
"""
# 'requires_source' is a wheel that depends on the 'source' project
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'download'
,
'setuptools'
,
'wheel'
,
'-d'
,
data
.
packages
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
result
=
script
.
pip
(
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'requires_source'
,
'wheel'
,
'--no-index'
,
'-f'
,
data
.
find_links
,
'-f'
,
common_wheels
,
'requires_source'
,
)
wheel_file_name
=
'source-1.0-py%s-none-any.whl'
%
pyversion
[
0
]
wheel_file_path
=
script
.
scratch
/
wheel_file_name
...
...
@@ -172,13 +174,14 @@ def test_pip_wheel_source_deps(script, data):
@
pytest
.
mark
.
network
def
test_pip_wheel_fail_cause_of_previous_build_dir
(
script
,
data
):
def
test_pip_wheel_fail_cause_of_previous_build_dir
(
script
,
data
,
common_wheels
):
"""
Test when 'pip wheel' tries to install a package that has a previous build
directory
"""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
# Given that I have a previous build dir of the `simple` package
build
=
script
.
venv_path
/
'build'
/
'simple'
...
...
@@ -198,9 +201,9 @@ def test_pip_wheel_fail_cause_of_previous_build_dir(script, data):
@
pytest
.
mark
.
network
def
test_wheel_package_with_latin1_setup
(
script
,
data
):
def
test_wheel_package_with_latin1_setup
(
script
,
data
,
common_wheels
):
"""Create a wheel from a package with latin-1 encoded setup.py."""
script
.
pip
(
'install'
,
'wheel'
)
script
.
pip
(
'install'
,
'wheel'
,
'--no-index'
,
'-f'
,
common_wheels
)
pkg_to_wheel
=
data
.
packages
.
join
(
"SetupPyLatin1"
)
result
=
script
.
pip
(
'wheel'
,
pkg_to_wheel
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录