Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
6a830765
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
11 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
6a830765
编写于
6月 14, 2012
作者:
F
fin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test submodule support
上级
94af30dc
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
87 addition
and
1 deletion
+87
-1
tests/git_submodule_helpers.py
tests/git_submodule_helpers.py
+62
-0
tests/test_vcs_git.py
tests/test_vcs_git.py
+25
-1
未找到文件。
tests/git_submodule_helpers.py
0 → 100644
浏览文件 @
6a830765
import
textwrap
from
tests.test_pip
import
(
mkdir
,
write_file
,)
def
_create_test_package_submodule
(
env
):
mkdir
(
'version_pkg_submodule'
)
submodule_path
=
env
.
scratch_path
/
'version_pkg_submodule'
env
.
run
(
'touch'
,
'testfile'
,
cwd
=
submodule_path
)
env
.
run
(
'git'
,
'init'
,
cwd
=
submodule_path
)
env
.
run
(
'git'
,
'add'
,
'.'
,
cwd
=
submodule_path
)
env
.
run
(
'git'
,
'commit'
,
'-q'
,
'--author'
,
'Pip <python-virtualenv@googlegroups.com>'
,
'-am'
,
'initial version / submodule'
,
cwd
=
submodule_path
)
return
submodule_path
def
_change_test_package_submodule
(
env
,
submodule_path
):
write_file
(
submodule_path
/
'testfile'
,
'this is a changed file'
)
write_file
(
submodule_path
/
'testfile2'
,
'this is an added file'
)
env
.
run
(
'git'
,
'add'
,
'.'
,
cwd
=
submodule_path
)
env
.
run
(
'git'
,
'commit'
,
'-q'
,
'--author'
,
'Pip <python-virtualenv@googlegroups.com>'
,
'-am'
,
'submodule change'
,
cwd
=
submodule_path
)
def
_pull_in_submodule_changes_to_module
(
env
,
module_path
):
env
.
run
(
*
(
'git submodule foreach git pull -q origin master'
.
split
(
' '
)),
cwd
=
module_path
)
# this only exists in git > 1.7.3
env
.
run
(
'git'
,
'commit'
,
'-q'
,
'--author'
,
'Pip <python-virtualenv@googlegroups.com>'
,
'-am'
,
'submodule change'
,
cwd
=
module_path
)
def
_create_test_package_with_submodule
(
env
):
mkdir
(
'version_pkg'
)
version_pkg_path
=
env
.
scratch_path
/
'version_pkg'
mkdir
(
version_pkg_path
/
'testpkg'
)
pkg_path
=
version_pkg_path
/
'testpkg'
write_file
(
'__init__.py'
,
'# hello there'
,
pkg_path
)
write_file
(
'version_pkg.py'
,
textwrap
.
dedent
(
'''
\
def main():
print('0.1')
'''
),
pkg_path
)
write_file
(
'setup.py'
,
textwrap
.
dedent
(
'''
\
from setuptools import setup, find_packages
setup(name='version_pkg',
version='0.1',
packages=find_packages(),
)
'''
),
version_pkg_path
)
env
.
run
(
'git'
,
'init'
,
cwd
=
version_pkg_path
)
env
.
run
(
'git'
,
'add'
,
'.'
,
cwd
=
version_pkg_path
)
env
.
run
(
'git'
,
'commit'
,
'-q'
,
'--author'
,
'Pip <python-virtualenv@googlegroups.com>'
,
'-am'
,
'initial version'
,
cwd
=
version_pkg_path
)
submodule_path
=
_create_test_package_submodule
(
env
)
env
.
run
(
'git'
,
'submodule'
,
'add'
,
submodule_path
,
'testpkg/static'
,
cwd
=
version_pkg_path
)
env
.
run
(
'git'
,
'commit'
,
'-q'
,
'--author'
,
'Pip <python-virtualenv@googlegroups.com>'
,
'-am'
,
'initial version w submodule'
,
cwd
=
version_pkg_path
)
return
version_pkg_path
,
submodule_path
tests/test_vcs_git.py
浏览文件 @
6a830765
from
mock
import
patch
from
pip.vcs.git
import
Git
from
tests.test_pip
import
(
reset_env
,
run_pip
,
_create_test_package
)
_create_test_package
,)
from
tests.git_submodule_helpers
import
_create_test_package_submodule
,
_change_test_package_submodule
,
_pull_in_submodule_changes_to_module
,
_create_test_package_with_submodule
def
test_get_tag_revs_should_return_tag_name_and_commit_pair
():
...
...
@@ -75,3 +76,26 @@ def test_check_rev_options_should_handle_ambiguous_commit(branches_revs_mock,
result
=
git
.
check_rev_options
(
'0.1'
,
'.'
,
[])
assert
result
==
[
'123456'
],
result
def
test_check_submodule_addition
():
"""
Test if submodules will be pulled in on install, and updated on upgrade
"""
env
=
reset_env
()
module_path
,
submodule_path
=
_create_test_package_with_submodule
(
env
)
install_result
=
run_pip
(
'install'
,
'-e'
,
'git+'
+
module_path
+
'#egg=version_pkg'
)
assert
'.virtualenv/src/version-pkg/testpkg/static/testfile'
in
install_result
.
files_created
_change_test_package_submodule
(
env
,
submodule_path
)
_pull_in_submodule_changes_to_module
(
env
,
module_path
)
update_result
=
run_pip
(
'install'
,
'-e'
,
'git+'
+
module_path
+
'#egg=version_pkg'
,
'--upgrade'
)
assert
env
.
venv
/
'src/version-pkg/testpkg/static/testfile2'
in
update_result
.
files_created
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录