py.test 的 Git 存储库夹具
项目描述
为测试创建一个空的 Git 存储库,该存储库在拆卸后自行清理。
安装
使用您喜欢的软件包安装程序进行安装:
pip install pytest-git
# or
easy_install pytest-git
在测试或 conftest.py 中显式启用夹具(使用 setuptools 入口点时不需要):
pytest_plugins = ['pytest_git']
用法
这个插件是优秀的 GitPython 库(见http://gitpython.readthedocs.org/en/stable/)的一个薄包装器。这是一个点头测试用例,表明它有效:
def test_git_repo(git_repo):
# The fixture derives from `workspace` in `pytest-shutil`, so they contain
# a handle to the path.py path object (see https://pathpy.readthedocs.io/)
path = git_repo.workspace
file = path / 'hello.txt'
file.write_text('hello world!')
# We can run commands relative to the working directory
git_repo.run('git add hello.txt')
# It's better to use the GitPython api directly - the 'api' attribute is
# a handle to the repository object.
git_repo.api.index.commit("Initial commit")
# The fixture has a URI property you can use in downstream systems
assert git_repo.uri.startswith('file://')
变更日志
1.7.0
全部:支持 pytest >= 4.0.0
全部:支持 Python 3.7
pytest-server-fixtures:如果您的机器上未定义主机,则默认为 localhost
pytest-server-fixture:由于上游 API 更改,固定到 rethinkdb < 2.4.0
pytest-verbose-parametrize:添加对改进后的标记基础设施的支持
pytest-verbose-parametrize:修复集成测试以支持 pytest >= 4.1.0
pytest-virtualenv:添加 virtualenv 作为安装要求。修复 #122
pytest-webdriver:使用 getfixturevalue 修复 RemovedInPytest4Warning
circleci:通过跳过没有推送访问权限的开发人员的整体提交来修复检查
轮子:生成可与 python 2.x 和 3.x 一起安装的通用轮子
dist:删除对构建和分发 *.egg 文件的支持
VagrantFile:默认安装python 3.7并初始化python 3.7
使用“logger.warning()”函数修复 DeprecationWarning 警告
1.6.2 (2019-02-21)
pytest-server-fixtures:如果调用 kill(),则禁止堆栈跟踪
pytest-server-fixtures:修复 TestServerV2 中的随机端口逻辑
1.6.1 (2019-02-12)
pytest-server-fixtures:在服务器未启动时尝试访问主机名时修复异常
1.6.0 (2019-02-12)
pytest-server-fixtures:添加了之前删除的 TestServerV2.kill() 函数
pytest-profiling:在集成测试中 pin more-itertools==5.0.0,因为这是 PY3 唯一版本
1.5.1 (2019-01-24)
pytest-verbose-parametrize:使用 @pytest.mark.parametrize时修复 unicode 参数
1.5.0 (2019-01-23)
pytest-server-fixtures:使 postgres 固定装置及其测试可选,就像所有其他固定装置一样
pytest-server-fixtures:恢复了对 pymongo 弃用警告的修复,因为这将破坏与 pymongo 3.6.0 的兼容性
pytest-server-fixtures:在 httpd 中删除了 RHEL5 支持
1.4.1 (2019-01-18)
pytest-server-fixtures:在 ENV 中指定的服务器夹具二进制路径现在只影响服务器类“线程”
1.4.0 (2019-01-15)
修复 Simple HTTP Server 夹具中的 python 3 兼容性
修复了 pytest-profiling 中损坏的测试
固定 pytest<4.0.0 直到修复所有弃用警告。
pytest-webdriver:用无头谷歌浏览器替换不推荐使用的 phantomjs。
将 Vagrantfile 添加到项目中以使测试环境可移植。
将 .editorconfig 文件添加到项目中。
pytest-server-fixtures:添加带有 Docker 和 Kubernetes 支持的 TestServerV2。
pytest-server-fixtures:修复 MinioServer 使用后未清理的问题。
pytest-server-fixtures:修复调用 pymongo 时的弃用警告。
pytest-server-fixtures:在 MongoTestServer 拆解时关闭 pymongo 客户端。
pytest-server-fixtures:将 Mongo、Redis 和 RethinkDB 升级到 TestServerV2。
工作服:修复破损的工作服
1.3.1 (2018-06-28)
使用 pymongo list_database_names() 代替已弃用的 database_names(),添加 pymongo>=3.6.0 依赖
1.3.0 (2017-11-17)
修复了当拆卸为无时删除工作区
修复了 pytest-listener 中根记录器的壁球
添加了 S3 Minio 夹具(非常感谢 Gavin Bisesi)
添加了 Postgres 夹具(非常感谢 Gavin Bisesi)
使用对服务器装置的请求 http 获取,因为它正确处理重定向和代理
1.2.12 (2017-8-1)
修复了缓存临时主机名的回归,一些客户端依赖于此。现在这是可选的。
1.2.11 (2017-7-21)
修复 OSX 绑定到非法本地 IP 范围的问题(感谢 Gavin Bisesi)
pytest-profiling 的设置和 Py3k 修复(感谢 xoviat)
在保留本地 IP 主机时,我们不再尝试绑定端口 5000,因为有人可能将其绑定到 0.0.0.0
当本地 venv 未激活时,修复 #46 源 gprof2dot
1.2.10 (2017-2-23)
在 pytest-webdriver 中处理自定义 Pytest 测试项
1.2.9 (2017-2-23)
将用户名添加到 mongo 服务器夹具 tempdir 路径以停止共享多用户文件系统上的冲突
1.2.8 (2017-2-21)
在 shutil.run.run_as_main 中返回函数结果
1.2.7 (2017-2-20)
对旧版本 path.py 的更多处理
允许在 pytest-virtualenv 中传递 virtualenv 参数
1.2.6 (2017-2-16 )
更新了 devpi-server >= 2.0 的 devpi 服务器服务器设置
随机端口选择的改进
HTTPD 服务器现在默认绑定到 0.0.0.0 以帮助进行 Selenium 风格的测试
更新了 mongodb >= 3.2 的 mongodb 服务器参数
更正 mongodb 夹具配置并改进启动逻辑
添加了模块范围的 mongodb 固定装置
处理旧版本的 path.py
修复 #40 中 chdir 中断 pytest-profiling 的测试
1.2.5 (2016-12-09)
服务器运行器主机和端口生成的改进,现在支持随机本地 IP
RethinkDB 夹具配置的错误修复
1.2.4 (2016-11-14)
pymongo 额外依赖的修正
pytest-virtualenv 的 Windows 兼容性修复(感谢 Jean-Christophe Fillion-Robin 的 PR)
修复 pytest-shutil.cmdline.get_real_python_executable 的符号链接处理
1.2.3 (2016-11-7)
提高 Mongo 夹具启动检查的弹性
1.2.2 (2016-10-27)
大多数模块的 Python 3 兼容性
修复了已弃用的 Path.py 导入(感谢 Bryan Moscon)
修复了 pytest-profiling 中不推荐使用的多重调用(感谢 Paul van der Linden 的 PR)
添加了 devpi-server 夹具来为每个测试函数创建一个索引
添加了缺少的许可证文件
拆分 httpd 服务器夹具配置,以便子类可以更轻松地覆盖加载的模块
向 TestServer 基类添加了“preserve_sys_path”参数,该基类将当前的 python sys.path 导出到子进程。
更新了当前 Ubuntu 规范的 httpd、redis 和 jenkins 运行时参数和路径
拆除工作区时忽略错误以避免“shutil.rmtree”实现中的竞争条件
1.2.1 (2016-3-1)
修复了最新版本 py.test 的 pytest-verbose-parametrize
1.2.0 (2016-2-19)
新插件:git 存储库夹具
1.1.1 (2016-2-16)
pytest-profiling 改进:转义 .prof 文件中的非法字符(感谢 Aarni Koskela 的 PR)
1.1.0 (2016-2-15)
新插件:devpi 服务器夹具
pytest-profiling 改进:过长的 .prof 文件保存为测试名称的短哈希(感谢 Vladimir Lagunov 的 PR)
出于安全原因,将workspace.run() 的默认行为更改为不使用子shell
更正 virtualenv.run() 方法以处理与父方法 workspace.run() 相同的参数
从 virtualenv args 中删除了已弃用的“--distribute”
1.0.1 (2015-12-23)
打包错误修复
1.0.0 (2015-12-21)
首次公开发布
项目详情
下载文件
下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。
源分布
内置发行版
pytest_git -1.7.0-py3.6.egg 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | a7672cd62e25505b83d805a66cfef79d7fced05031919e3f23727f6c9df5aca4 |
|
| MD5 | cb48516d0bde149ebbbcc05dcbb651e9 |
|
| 布莱克2-256 | d908e0365b6328722fa78730b3eafca82d855045b052f5bcfdc3985843967d14 |
pytest_git -1.7.0-py2.py3-none-any.whl 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | f0737e688bb6d53b4a501d9eba340885e63522ee57e17c24137525c7d9a17361 |
|
| MD5 | a2baf768e38b28f7d7a314de456e6808 |
|
| 布莱克2-256 | dbab377c414fb98265ec2a390cbef620a6edca952656bcb001dcc4513886f71e |
pytest_git -1.7.0-py2.7.egg 的哈希值
| 算法 | 哈希摘要 | |
|---|---|---|
| SHA256 | 43bea064524b8e2b814960ec0e5506cacd00db8eab636a991b7d426e3ee2bd01 |
|
| MD5 | c2fd8277add564fce523926a7ba7e121 |
|
| 布莱克2-256 | 29f0af5ec24a987d6b83bf46fc4cdf4a90df01ab42214886685bec0b587dc2a9 |