RSpec 是否有 Python 等价物来执行 TDD? [英] Is there a python equivalent for RSpec to do TDD?

查看:31
本文介绍了RSpec 是否有 Python 等价物来执行 TDD?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找像 Ruby 的 RSpec 这样的测试框架来在 Python 中进行测试驱动开发.像 RSpec 这样的框架的优势在于它提供了一种非常适合 TDD 的 DSL.首先,您用英语描述测试,然后编写测试,当测试失败时,您会收到一条消息,说明测试失败,并详细描述了测试尝试执行的操作.

I'm looking for a test framework like Ruby's RSpec to do test driven development in Python. The advantage of a framework like RSpec is that it offers a DSL that lends itself well to TDD. First you describe the test in english, and then you write the test, and when it fails you get a message saying what test failed with your nice description of what the test is trying to do.

到目前为止,我已经看过 PyTest 和 Nose.PyTest 似乎比 RSpec 更接近 ruby​​ 的 MiniTest.它没有提供带有语言的 DSL 使其像规范一样阅读,而是专注于断言.Nose 似乎是 PyTest 的包装器,没有添加自己的 DSL.

So far I've looked at PyTest and Nose. PyTest seems closer to ruby's MiniTest than RSpec. Instead of offering a DSL with language to make it read like specifications, it focuses on assertions. Nose seems like a wrapper on PyTest that doesn't add its own DSL.

我还缺少其他选项吗?还是我只是滥用 PyTest 和 Nose?Python 社区是否已经确定了一些完全不同的方式来做这件事,我应该停止尝试让它像 Ruby 一样?根据 GitHub 上的星星数量,社区似乎并未真正将这两个选项中的任何一个指定为首选测试框架.

Is there another option I'm missing? Or am I just misusing PyTest and Nose? Has the Python community settled on some totally different way of doing this and I should stop trying to make it like Ruby? It doesn't seem, based on the number of stars on GitHub, that the community has really anointed either of these options as the preferred testing framework.

推荐答案

我最接近做一个简短的谷歌搜索的是 mamba + expects:

The closest I have come to doing a brief google search was mamba + expects:

这篇关于RSpec 是否有 Python 等价物来执行 TDD?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆