【发布时间】:2013-10-11 01:21:10
【问题描述】:
Unitest 案例非常有用,尤其是对于缺少 UI 部分的项目。 我在 Django 中做了最简单的案例。首先使用缩进将表数据转储到 json 中
python manage.py dumpdata --indent=4 APP_NAME > FILENAME.json
然后在测试用例中使用这个 Fixture。
class MyAppTestCase(TestCase):
fixtures = ['FILENAME.json']
def test_index(self):
pass
我在 SQLAlchemy 中寻找相同的东西。 SQLAlchemyFixture 可以,但不如 Django 方法使用 json 中的夹具来使用测试用例。 在 SQLAlchemy 中是否有人有任何方法可以做到这一点。
【问题讨论】:
标签: django sqlalchemy