Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Python_Packaging_Authority
pip
提交
f805f328
P
pip
项目概览
镜像
/
Python_Packaging_Authority
/
pip
10 个月 前同步成功
通知
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,体验更适合开发者的 AI 搜索 >>
提交
f805f328
编写于
8月 16, 2019
作者:
C
Chris Hunt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Align interface of tests.lib.path.Path.mkdir with pathlib.Path.mkdir.
上级
a6b06059
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
35 addition
and
20 deletion
+35
-20
tests/functional/test_install.py
tests/functional/test_install.py
+2
-1
tests/functional/test_pep517.py
tests/functional/test_pep517.py
+6
-3
tests/functional/test_uninstall_user.py
tests/functional/test_uninstall_user.py
+1
-1
tests/lib/__init__.py
tests/lib/__init__.py
+3
-2
tests/lib/path.py
tests/lib/path.py
+6
-5
tests/lib/venv.py
tests/lib/venv.py
+1
-1
tests/unit/test_collector.py
tests/unit/test_collector.py
+2
-1
tests/unit/test_compat.py
tests/unit/test_compat.py
+4
-2
tests/unit/test_locations.py
tests/unit/test_locations.py
+4
-2
tests/unit/test_utils.py
tests/unit/test_utils.py
+6
-2
未找到文件。
tests/functional/test_install.py
浏览文件 @
f805f328
...
...
@@ -551,7 +551,8 @@ def test_editable_install__local_dir_no_setup_py_with_pyproject(
Test installing in editable mode from a local directory with no setup.py
but that does have pyproject.toml.
"""
local_dir
=
script
.
scratch_path
.
joinpath
(
'temp'
).
mkdir
()
local_dir
=
script
.
scratch_path
.
joinpath
(
'temp'
)
local_dir
.
mkdir
()
pyproject_path
=
local_dir
.
joinpath
(
'pyproject.toml'
)
pyproject_path
.
write_text
(
''
)
...
...
tests/functional/test_pep517.py
浏览文件 @
f805f328
...
...
@@ -7,7 +7,8 @@ from tests.lib import make_test_finder, path_to_url
def
make_project
(
tmpdir
,
requires
=
[],
backend
=
None
):
project_dir
=
(
tmpdir
/
'project'
).
mkdir
()
project_dir
=
tmpdir
/
'project'
project_dir
.
mkdir
()
buildsys
=
{
'requires'
:
requires
}
if
backend
:
buildsys
[
'build-backend'
]
=
backend
...
...
@@ -125,7 +126,8 @@ def test_pep517_install_with_no_cache_dir(script, tmpdir, data):
def
make_pyproject_with_setup
(
tmpdir
,
build_system
=
True
,
set_backend
=
True
):
project_dir
=
(
tmpdir
/
'project'
).
mkdir
()
project_dir
=
tmpdir
/
'project'
project_dir
.
mkdir
()
setup_script
=
(
'from setuptools import setup
\n
'
)
...
...
@@ -161,7 +163,8 @@ def make_pyproject_with_setup(tmpdir, build_system=True, set_backend=True):
project_dir
.
joinpath
(
'pyproject.toml'
).
write_text
(
project_data
)
project_dir
.
joinpath
(
'setup.py'
).
write_text
(
setup_script
)
package_dir
=
(
project_dir
/
"pep517_test"
).
mkdir
()
package_dir
=
project_dir
/
"pep517_test"
package_dir
.
mkdir
()
package_dir
.
joinpath
(
'__init__.py'
).
write_text
(
'__version__ = "0.1"'
)
return
project_dir
,
"pep517_test"
...
...
tests/functional/test_uninstall_user.py
浏览文件 @
f805f328
...
...
@@ -51,7 +51,7 @@ class Tests_UninstallUserSite:
"""
Test uninstall editable local user install
"""
script
.
user_site_path
.
mkdir
(
parents
=
True
)
assert
script
.
user_site_path
.
exists
(
)
# install
to_install
=
data
.
packages
.
joinpath
(
"FSPkg"
)
...
...
tests/lib/__init__.py
浏览文件 @
f805f328
...
...
@@ -451,7 +451,8 @@ class PipTestEnvironment(TestFileEnvironment):
)
# Create a Directory to use as a scratch pad
self
.
scratch_path
=
base_path
.
joinpath
(
"scratch"
).
mkdir
()
self
.
scratch_path
=
base_path
.
joinpath
(
"scratch"
)
self
.
scratch_path
.
mkdir
()
# Set our default working directory
kwargs
.
setdefault
(
"cwd"
,
self
.
scratch_path
)
...
...
@@ -988,7 +989,7 @@ def create_basic_wheel_for_package(script, name, version,
for
fname
in
files
:
path
=
script
.
temp_path
/
fname
path
.
parent
.
mkdir
()
path
.
parent
.
mkdir
(
exist_ok
=
True
)
path
.
write_text
(
files
[
fname
])
retval
=
script
.
scratch_path
/
archive_name
...
...
tests/lib/path.py
浏览文件 @
f805f328
...
...
@@ -154,18 +154,19 @@ class Path(_base):
"""
return
os
.
path
.
exists
(
self
)
def
mkdir
(
self
,
mode
=
0x1FF
,
parents
=
False
):
# 0o777
def
mkdir
(
self
,
mode
=
0x1FF
,
exist_ok
=
False
,
parents
=
False
):
# 0o777
"""
Creates a directory, if it doesn't exist already.
:param parents: Whether to create parent directories.
"""
if
self
.
exists
():
return
self
maker_func
=
os
.
makedirs
if
parents
else
os
.
mkdir
maker_func
(
self
,
mode
)
return
self
try
:
maker_func
(
self
,
mode
)
except
OSError
:
if
not
exist_ok
or
not
os
.
path
.
isdir
(
self
):
raise
def
unlink
(
self
):
"""
...
...
tests/lib/venv.py
浏览文件 @
f805f328
...
...
@@ -75,7 +75,7 @@ class VirtualEnvironment(object):
context
=
builder
.
ensure_directories
(
self
.
location
)
builder
.
create_configuration
(
context
)
builder
.
setup_python
(
context
)
self
.
site
.
mkdir
(
parents
=
True
)
self
.
site
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
self
.
sitecustomize
=
self
.
_sitecustomize
self
.
user_site_packages
=
self
.
_user_site_packages
...
...
tests/unit/test_collector.py
浏览文件 @
f805f328
...
...
@@ -358,7 +358,8 @@ def make_fake_html_response(url):
def
test_get_html_page_directory_append_index
(
tmpdir
):
"""`_get_html_page()` should append "index.html" to a directory URL.
"""
dirpath
=
tmpdir
.
mkdir
(
"something"
)
dirpath
=
tmpdir
/
"something"
dirpath
.
mkdir
()
dir_url
=
"file:///{}"
.
format
(
urllib_request
.
pathname2url
(
dirpath
).
lstrip
(
"/"
),
)
...
...
tests/unit/test_compat.py
浏览文件 @
f805f328
...
...
@@ -31,7 +31,8 @@ def test_get_path_uid_without_NOFOLLOW(monkeypatch):
@
pytest
.
mark
.
skipif
(
"sys.platform == 'win32'"
)
@
pytest
.
mark
.
skipif
(
"not hasattr(os, 'symlink')"
)
def
test_get_path_uid_symlink
(
tmpdir
):
f
=
tmpdir
.
mkdir
(
"symlink"
).
joinpath
(
"somefile"
)
f
=
tmpdir
/
"symlink"
/
"somefile"
f
.
parent
.
mkdir
()
f
.
write_text
(
"content"
)
fs
=
f
+
'_link'
os
.
symlink
(
f
,
fs
)
...
...
@@ -43,7 +44,8 @@ def test_get_path_uid_symlink(tmpdir):
@
pytest
.
mark
.
skipif
(
"not hasattr(os, 'symlink')"
)
def
test_get_path_uid_symlink_without_NOFOLLOW
(
tmpdir
,
monkeypatch
):
monkeypatch
.
delattr
(
"os.O_NOFOLLOW"
)
f
=
tmpdir
.
mkdir
(
"symlink"
).
joinpath
(
"somefile"
)
f
=
tmpdir
/
"symlink"
/
"somefile"
f
.
parent
.
mkdir
()
f
.
write_text
(
"content"
)
fs
=
f
+
'_link'
os
.
symlink
(
f
,
fs
)
...
...
tests/unit/test_locations.py
浏览文件 @
f805f328
...
...
@@ -96,7 +96,8 @@ class TestDistutilsScheme:
# This deals with nt/posix path differences
install_scripts
=
os
.
path
.
normcase
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
sep
,
'somewhere'
,
'else'
)))
f
=
tmpdir
.
mkdir
(
"config"
).
joinpath
(
"setup.cfg"
)
f
=
tmpdir
/
"config"
/
"setup.cfg"
f
.
parent
.
mkdir
()
f
.
write_text
(
"[install]
\n
install-scripts="
+
install_scripts
)
from
distutils.dist
import
Distribution
# patch the function that returns what config files are present
...
...
@@ -116,7 +117,8 @@ class TestDistutilsScheme:
# This deals with nt/posix path differences
install_lib
=
os
.
path
.
normcase
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
sep
,
'somewhere'
,
'else'
)))
f
=
tmpdir
.
mkdir
(
"config"
).
joinpath
(
"setup.cfg"
)
f
=
tmpdir
/
"config"
/
"setup.cfg"
f
.
parent
.
mkdir
()
f
.
write_text
(
"[install]
\n
install-lib="
+
install_lib
)
from
distutils.dist
import
Distribution
# patch the function that returns what config files are present
...
...
tests/unit/test_utils.py
浏览文件 @
f805f328
...
...
@@ -303,7 +303,9 @@ def test_rmtree_errorhandler_readonly_directory(tmpdir):
Test rmtree_errorhandler makes the given read-only directory writable.
"""
# Create read only directory
path
=
str
((
tmpdir
/
'subdir'
).
mkdir
())
subdir_path
=
tmpdir
/
'subdir'
subdir_path
.
mkdir
()
path
=
str
(
subdir_path
)
os
.
chmod
(
path
,
stat
.
S_IREAD
)
# Make sure mock_func is called with the given path
...
...
@@ -321,7 +323,9 @@ def test_rmtree_errorhandler_reraises_error(tmpdir):
by the given unreadable directory.
"""
# Create directory without read permission
path
=
str
((
tmpdir
/
'subdir'
).
mkdir
())
subdir_path
=
tmpdir
/
'subdir'
subdir_path
.
mkdir
()
path
=
str
(
subdir_path
)
os
.
chmod
(
path
,
stat
.
S_IWRITE
)
mock_func
=
Mock
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录