bitbake: toaster: fixed pytest error: Database access not allowed, use the "django_db"

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.

https://pytest-django.readthedocs.io/en/latest/helpers.html#pytest-mark-django-db-request-database-access

(Bitbake rev: 5f92a6b13cdea26b26ff939e9a3f746f7d0937b7)

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Alassane Yattara
2023-11-09 16:55:41 +01:00
committed by Richard Purdie
parent 20705f46af
commit dcb6a5cca6

View File

@@ -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'))