python - pytest-django 中的重置序列

标签 python django pytest

我已将我的问题发布到 pytest-django 。但似乎至少有两周不活跃。我决定在这里问我的问题。

在我的测试中我想使用reset_sequence=True
如何在 pytest-django 中做到这一点?

最佳答案

在最新的 pytest-django 3.8.0 中,您可以执行 @pytest.mark.django_db(transaction=True,reset_sequences=True) 来使用 reset_sequences。您可以在 this 中找到它官方文档

关于python - pytest-django 中的重置序列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47904245/

相关文章:

Django reversion 不保存在 shell 中所做的修订

python - 警告 : Failed to generate report: No data to report error in python using pytest module

javascript - 为什么我没有从 JS 客户端(作为 Chrome 扩展)收到任何内容?

python - 如何使用核密度估计绘制样本

python 2.7 xml - 从注释下方的特定注释中获取值

python-3.x - pytest - 默认 fixture 参数值

python-3.x - vscode pytest 测试发现因缺少环境变量而失败

python - 在python中,如何生成一个范围内的随机整数,不包括列表中的某些数字?

python - 在 HttpResponse() 调用后,Django View 没有得到完全处理

python - django rest框架中的自定义过滤