diff options
author | Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com> | 2023-12-01 09:48:33 -0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-12-06 22:36:53 +0000 |
commit | 7f4dfaa5bd28ccf1ae0122d984ffa7e02e693960 (patch) | |
tree | 06fa0494107ea2b17d6b3ccdafe1b6338ce02caa | |
parent | 651a6dcf6f8ff33a4e9290a37c23e4f243974ac3 (diff) | |
download | bitbake-7f4dfaa5bd28ccf1ae0122d984ffa7e02e693960.tar.gz |
toaster: fix pytest build test execution and test discovery
Ensure the proper django settings are used by moving the variable to
the environment assignment.
Remove python file specifier as this works relative to the working
directory, which can vary. The test file directory can instead be
specified when executing the pytest command.
Add annotations required to allow database access with pytest to the
build tests.
Signed-off-by: Alexander Lussier-Cullen <alexander.lussier-cullen@savoirfairelinux.com>
CC: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/toaster/pytest.ini | 5 | ||||
-rw-r--r-- | lib/toaster/tests/builds/test_core_image_min.py | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/toaster/pytest.ini b/lib/toaster/pytest.ini index f07076b7e..071c65fcd 100644 --- a/lib/toaster/pytest.ini +++ b/lib/toaster/pytest.ini @@ -1,9 +1,5 @@ # -- FILE: pytest.ini (or tox.ini) [pytest] -DJANGO_SETTINGS_MODULE = toastermain.settings_test - -python_files = db/test_*.py commands/test_*.py views/test_*.py browser/test_*.py functional/test_*.py - # --create-db - force re creation of the test database # https://pytest-django.readthedocs.io/en/latest/database.html#create-db-force-re-creation-of-the-test-database @@ -17,3 +13,4 @@ addopts = --create-db --html="Toaster Tests Report.html" --self-contained-html # https://pypi.org/project/pytest-env/ env = TOASTER_BUILDSERVER=1 + DJANGO_SETTINGS_MODULE=toastermain.settings_test diff --git a/lib/toaster/tests/builds/test_core_image_min.py b/lib/toaster/tests/builds/test_core_image_min.py index 9cdaa15f9..ca388eabe 100644 --- a/lib/toaster/tests/builds/test_core_image_min.py +++ b/lib/toaster/tests/builds/test_core_image_min.py @@ -10,6 +10,7 @@ # Ionut Chisanovici, Paul Eggleton and Cristian Iorga import os +import pytest from django.db.models import Q @@ -21,6 +22,7 @@ from orm.models import CustomImagePackage from tests.builds.buildtest import BuildTest +@pytest.mark.django_db(True) class BuildCoreImageMinimal(BuildTest): """Build core-image-minimal and test the results""" |