Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
c1109537
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,发现更多精彩内容 >>
未验证
提交
c1109537
编写于
4月 09, 2020
作者:
P
Pradyun Gedam
提交者:
GitHub
4月 09, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #7958 from ilanschnell/add-yaml-options
Add ability to run pip with options for yaml tests
上级
327a3153
2b883d5d
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
83 addition
and
67 deletion
+83
-67
tests/functional/test_yaml.py
tests/functional/test_yaml.py
+33
-36
tests/yaml/install/circular.yml
tests/yaml/install/circular.yml
+8
-8
tests/yaml/install/conflicting_diamond.yml
tests/yaml/install/conflicting_diamond.yml
+1
-1
tests/yaml/install/conflicting_triangle.yml
tests/yaml/install/conflicting_triangle.yml
+2
-2
tests/yaml/install/extras.yml
tests/yaml/install/extras.yml
+6
-6
tests/yaml/install/non_pinned.yml
tests/yaml/install/non_pinned.yml
+4
-4
tests/yaml/install/pinned.yml
tests/yaml/install/pinned.yml
+6
-6
tests/yaml/install/simple.yml
tests/yaml/install/simple.yml
+23
-4
未找到文件。
tests/functional/test_yaml.py
浏览文件 @
c1109537
...
...
@@ -92,26 +92,33 @@ def convert_to_dict(string):
return
retval
def
handle_
install_request
(
script
,
requirement
):
def
handle_
request
(
script
,
action
,
requirement
,
options
):
assert
isinstance
(
requirement
,
str
),
(
"Need install requirement to be a string only"
)
result
=
script
.
pip
(
"install"
,
"--no-index"
,
"--find-links"
,
path_to_url
(
script
.
scratch_path
),
requirement
,
"--verbose"
,
allow_stderr_error
=
True
,
allow_stderr_warning
=
True
,
)
if
action
==
'install'
:
args
=
[
'install'
,
"--no-index"
,
"--find-links"
,
path_to_url
(
script
.
scratch_path
)]
elif
action
==
'uninstall'
:
args
=
[
'uninstall'
,
'--yes'
]
else
:
raise
"Did not excpet action: {!r}"
.
format
(
action
)
args
.
append
(
requirement
)
args
.
extend
(
options
)
args
.
append
(
"--verbose"
)
result
=
script
.
pip
(
*
args
,
allow_stderr_error
=
True
,
allow_stderr_warning
=
True
)
retval
=
{
"_result_object"
:
result
,
}
if
result
.
returncode
==
0
:
# Check which packages got installed
retval
[
"
install
"
]
=
[]
retval
[
"
state
"
]
=
[]
for
path
in
result
.
files_created
:
for
path
in
os
.
listdir
(
script
.
site_packages_path
)
:
if
path
.
endswith
(
".dist-info"
):
name
,
version
=
(
os
.
path
.
basename
(
path
)[:
-
len
(
".dist-info"
)]
...
...
@@ -119,12 +126,9 @@ def handle_install_request(script, requirement):
# TODO: information about extras.
retval
[
"install"
].
append
(
" "
.
join
((
name
,
version
)))
retval
[
"install"
].
sort
()
retval
[
"state"
].
append
(
" "
.
join
((
name
,
version
)))
# TODO: Support checking uninstallations
# retval["uninstall"] = []
retval
[
"state"
].
sort
()
elif
"conflicting"
in
result
.
stderr
.
lower
():
retval
[
"conflicting"
]
=
[]
...
...
@@ -151,10 +155,10 @@ def handle_install_request(script, requirement):
def
test_yaml_based
(
script
,
case
):
available
=
case
.
get
(
"available"
,
[])
requests
=
case
.
get
(
"request"
,
[])
transaction
=
case
.
get
(
"transaction
"
,
[])
responses
=
case
.
get
(
"response
"
,
[])
assert
len
(
requests
)
==
len
(
transaction
),
(
"Expected requests and
transaction
counts to be same"
assert
len
(
requests
)
==
len
(
responses
),
(
"Expected requests and
responses
counts to be same"
)
# Create a custom index of all the packages that are supposed to be
...
...
@@ -168,26 +172,19 @@ def test_yaml_based(script, case):
create_basic_wheel_for_package
(
script
,
**
package
)
available_actions
=
{
"install"
:
handle_install_request
}
# use scratch path for index
for
request
,
expected
in
zip
(
requests
,
transaction
):
# The name of the key is what action has to be taken
assert
len
(
request
.
keys
())
==
1
,
"Expected only one action"
for
request
,
response
in
zip
(
requests
,
responses
):
# Get the only key
action
=
list
(
request
.
keys
())[
0
]
assert
action
in
available_actions
.
keys
(),
(
"Unsupported action {!r}"
.
format
(
action
)
)
for
action
in
'install'
,
'uninstall'
:
if
action
in
request
:
break
else
:
raise
"Unsupported request {!r}"
.
format
(
request
)
# Perform the requested action
effect
=
available_actions
[
action
](
script
,
request
[
action
])
result
=
effect
[
"_result_object"
]
del
effect
[
"_result_object"
]
effect
=
handle_request
(
script
,
action
,
request
[
action
],
request
.
get
(
'options'
,
''
).
split
())
assert
effect
==
expected
,
str
(
result
)
assert
effect
[
'state'
]
==
(
response
[
'state'
]
or
[]),
\
str
(
effect
[
"_result_object"
])
tests/yaml/install/circular.yml
浏览文件 @
c1109537
...
...
@@ -10,8 +10,8 @@ cases:
-
request
:
-
install
:
A
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
-
C 1.0.0
...
...
@@ -19,8 +19,8 @@ cases:
-
request
:
-
install
:
B
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
-
C 1.0.0
...
...
@@ -28,8 +28,8 @@ cases:
-
request
:
-
install
:
C
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
-
C 1.0.0
...
...
@@ -37,8 +37,8 @@ cases:
-
request
:
-
install
:
D
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
-
C 1.0.0
...
...
tests/yaml/install/conflicting_diamond.yml
浏览文件 @
c1109537
...
...
@@ -8,7 +8,7 @@ cases:
-
D 2.0.0
request
:
-
install
:
A
transaction
:
response
:
-
conflicting
:
-
required_by
:
[
A 1.0.0
,
B 1.0.0
]
selector
:
D == 1.0.0
...
...
tests/yaml/install/conflicting_triangle.yml
浏览文件 @
c1109537
...
...
@@ -8,8 +8,8 @@ cases:
request
:
-
install
:
A
-
install
:
B
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
C 1.0.0
-
conflicting
:
...
...
tests/yaml/install/extras.yml
浏览文件 @
c1109537
...
...
@@ -15,24 +15,24 @@ cases:
-
request
:
-
install
:
B
transaction
:
-
install
:
response
:
-
state
:
-
B 1.0.0
-
D 1.0.0
-
E 1.0.0
-
request
:
-
install
:
C
transaction
:
-
install
:
response
:
-
state
:
-
C 1.0.0
-
D 1.0.0
-
F 1.0.0
-
request
:
-
install
:
A
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
-
C 1.0.0
...
...
tests/yaml/install/non_pinned.yml
浏览文件 @
c1109537
...
...
@@ -11,14 +11,14 @@ cases:
-
request
:
-
install
:
A >= 2.0.0
transaction
:
-
install
:
response
:
-
state
:
-
A 2.0.0
-
B 2.1.0
-
request
:
-
install
:
A < 2.0.0
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
tests/yaml/install/pinned.yml
浏览文件 @
c1109537
...
...
@@ -9,21 +9,21 @@ cases:
-
request
:
-
install
:
B
transaction
:
-
install
:
response
:
-
state
:
-
A 2.0.0
-
B 2.0.0
-
request
:
-
install
:
B == 2.0.0
transaction
:
-
install
:
response
:
-
state
:
-
A 2.0.0
-
B 2.0.0
-
request
:
-
install
:
B == 1.0.0
transaction
:
-
install
:
response
:
-
state
:
-
A 1.0.0
-
B 1.0.0
tests/yaml/install/simple.yml
浏览文件 @
c1109537
...
...
@@ -9,13 +9,32 @@ cases:
-
request
:
-
install
:
simple
transaction
:
-
install
:
-
uninstall
:
simple
response
:
-
state
:
-
simple 0.2.0
-
state
:
null
-
request
:
-
install
:
simple
-
install
:
dep
response
:
-
state
:
-
simple 0.2.0
-
state
:
-
dep 0.1.0
-
simple 0.2.0
-
request
:
-
install
:
base
transaction
:
-
install
:
response
:
-
state
:
-
base 0.1.0
-
dep 0.1.0
-
request
:
-
install
:
base
options
:
--no-deps
response
:
-
state
:
-
base 0.1.0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录