我正在尝试测试一个登录视图,无论我尝试什么,我都会得到: Database access not allowed, use the "django_db" mark, or the "db" or "transactional_db我的测试: import pytest
def test_login(client):
#我尝试过在documentation中使用类似于scope=&
为了学习,我尝试编写一个补丁Django的authenticate函数的测试,以避免访问数据库。我编写的代码不起作用,我也不明白为什么。我已经浏览过网络,但我发现很多我读到的东西令人困惑。任何帮助都将不胜感激。E Failed: Database access not allowed, use the "django_db" mark, or
我正在使用pytest-django为django应用程序编写单元测试。我想让我的测试更有性能,这样做需要我将数据保存在数据库中一段时间,而不是只在一次测试后丢弃它。例如: @pytest.mark.django_db p1 = MyModel.objects.create(description="some description") # this object has the id 1
@pytest.mark