百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
P

pytest-testinfra

> DevOps
开源

Testinfra 可测试您的基础架构

2.5K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Testinfra 可测试您的基础架构

################################## Testinfra 用于测试您的基础架构 ##################################

Testinfra 旨在成为 Python 中的 Serverspec 等价物,它是作为一个插件来编写的,用于强大的 Pytest 测试引擎。

def test_passwd_file(host): passwd = host.file("/etc/passwd") assert passwd.contains("root") assert passwd.user == "root" assert passwd.group == "root" assert passwd.mode == 0o644 def test_nginx_is_installed(host): nginx = host.package("nginx") assert nginx.is_installed assert nginx.version.startswith("1.2") def test_nginx_running_and_enabled(host): nginx = host.service("nginx") assert nginx.is_running assert nginx.is_enabled 然后运行它: $ pytest -v test_myinfra.py

===================== 测试会话开始 ====================== 平台 Linux -- Python 2.7.3 -- py-1.4.26 -- pytest-2.6.4 插件: testinfra 收集了 3 个项目 test_myinfra.py::tes

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Pythonansiblechefdevopsdevops-tools

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类DevOps
定价开源

> 相关工具

D
Docker
容器化平台,标准化应用交付
G
GitHub Actions
GitHub 原生 CI/CD 工作流
N
Nginx
高性能 Web 服务器与反向代理