[英]Are there database testing tools for python (like sqlunit)?
Are there database testing tools for python (like sqlunit)? 是否有python的数据库测试工具(如sqlunit)? I want to test the DAL that is built using sqlalchemy
我想测试使用sqlalchemy构建的DAL
Follow the design pattern that Django uses. 遵循Django使用的设计模式。
Create a disposable copy of the database. 创建数据库的一次性副本。 Use SQLite3 in-memory, for example.
例如,在内存中使用SQLite3。
Create the database using the SQLAlchemy table and index definitions. 使用SQLAlchemy表和索引定义创建数据库。 This should be a fairly trivial exercise.
这应该是一项相当简单的工作。
Load the test data fixture into the database. 将测试数据夹具加载到数据库中。
Run your unit test case in a database with a known, defined state. 在具有已知,已定义状态的数据库中运行单元测试用例。
Dispose of the database. 处理数据库。
If you use SQLite3 in-memory, this procedure can be reasonably fast. 如果在内存中使用SQLite3,则此过程可以相当快。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.