From patchwork Mon Oct 30 19:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alassane Yattara X-Patchwork-Id: 33117 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7C12C4167B for ; Mon, 30 Oct 2023 19:51:54 +0000 (UTC) Received: from mail.savoirfairelinux.com (mail.savoirfairelinux.com [208.88.110.44]) by mx.groups.io with SMTP id smtpd.web10.159190.1698695505979666963 for ; Mon, 30 Oct 2023 12:51:46 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@savoirfairelinux.com header.s=DFC430D2-D198-11EC-948E-34200CB392D2 header.b=LPy2FB4M; spf=pass (domain: savoirfairelinux.com, ip: 208.88.110.44, mailfrom: alassane.yattara@savoirfairelinux.com) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id 50A499C2BF2 for ; Mon, 30 Oct 2023 15:51:45 -0400 (EDT) Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10032) with ESMTP id KKOtTd_XmdXl; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.savoirfairelinux.com (Postfix) with ESMTP id D115F9C2CC2; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.savoirfairelinux.com D115F9C2CC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=savoirfairelinux.com; s=DFC430D2-D198-11EC-948E-34200CB392D2; t=1698695504; bh=DRXCA7E2TGMUv0v25Wxw/oByR5RBeNsF5Xe+aiJyKEI=; h=From:To:Date:Message-Id:MIME-Version; b=LPy2FB4Mezx/MwG72UreCCO+DPGDYwQs+AG/5GOrg9LVdlRzq8RvIAe2ovgd0Eufn NwZ3v3Adai03NBpLxdfTi0aUg2jRxypnofPb8mFppV2RYf0xc4d0aOEEGigyehKUvK xPjcaX+rHH92oQhLVeIQYx5A5CmqyTuwntBqONjJOML16MjaX5lPmKgDHtHOlC5r4D Y39Ys3m9rp2wnMSFixaHWMKBypWLIsIMVVeP5VlcQPHZ63jaXhcPTVyJdqnerHe4WU E5yyAqpwZtYtMR4GTTZ484IZsTZAg0zFqIxvJdF4cjcBm6/DHLOoKr0pl0IyRreNAO ivpgsmyhv3D6g== X-Virus-Scanned: amavis at mail.savoirfairelinux.com Received: from mail.savoirfairelinux.com ([127.0.0.1]) by localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavis, port 10026) with ESMTP id oB3eya-PrySA; Mon, 30 Oct 2023 15:51:44 -0400 (EDT) Received: from localhost.localdomain (unknown [192.168.51.254]) by mail.savoirfairelinux.com (Postfix) with ESMTPSA id EE9BD9C0C3C; Mon, 30 Oct 2023 15:51:43 -0400 (EDT) From: Alassane Yattara To: toaster@lists.yoctoproject.org Cc: Alassane Yattara Subject: [PATCH 4/8] Toaster: fixed pytest error: Database access not allowed, use the "django_db" Date: Mon, 30 Oct 2023 20:51:28 +0100 Message-Id: <20231030195132.235083-4-alassane.yattara@savoirfairelinux.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> References: <20231030195132.235083-1-alassane.yattara@savoirfairelinux.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 30 Oct 2023 19:51:54 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/toaster/message/5907 Pytest failed on functional/test_functional_basic because database access not allowed - we should use "django_db" fixture to allowed db access Note: Pytest-django takes a conservative approach to enabling database access. By default your tests will fail if they try to access the database. Only if you explicitly request database access will this be allowed. Signed-off-by: Alassane Yattara --- lib/toaster/tests/functional/test_functional_basic.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/toaster/tests/functional/test_functional_basic.py b/lib/toaster/tests/functional/test_functional_basic.py index b0def544..7e9be91c 100644 --- a/lib/toaster/tests/functional/test_functional_basic.py +++ b/lib/toaster/tests/functional/test_functional_basic.py @@ -8,6 +8,7 @@ # import re, time +import pytest from django.urls import reverse from tests.functional.functional_helpers import SeleniumFunctionalTestCase from orm.models import Project @@ -16,6 +17,7 @@ from selenium.webdriver.common.by import By class FuntionalTestBasic(SeleniumFunctionalTestCase): # testcase (1514) + @pytest.mark.django_db def test_create_slenium_project(self): project_name = 'selenium-project' self.get(reverse('newproject'))