在 SQLAlchemy-migrate 中,使用“test”有什么意义?
为什么使用 py manage.py test ?
有什么意义?无论如何它都会创建表...如果我想测试它,那么我不希望它创建实际的表!
Why use py manage.py test
?
What's the point? It creates the table anyway... if I wanted to test it, then I wouldn't want it to create the actual table!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
测试旨在执行升级和降级步骤。您想要验证应用程序在这两种状态下都可用。因此,我们的想法是升级,运行测试,降级,运行测试,并验证你没有破坏东西。
如果测试运行失败,您将有机会清理、重置并重试。通常,我会说测试运行必须完全干净,然后迁移才被认为是“良好的”并且能够提交到代码库。
Test is meant to perform both the upgrade and the downgrade steps. You want to verify that the application is usable in both states. So the idea would be to upgrade, run tests, downgrade, run tests, and verify you don't break things.
If the test run fails, it gives you a chance to clean it up, reset, and try again. Usually, I'd say that the test run must completely cleanly before the migration is considered "good" and able to be committed to the code base.