diff mbox series

[3/8] Toaster: Bug-fix pytest and Failed: Database access not allowed

Message ID 20231030195037.232912-3-alassane.yattara@savoirfairelinux.com
State New
Headers show
Series [1/8] Toaster: Update toaster-requirements.txt to add pytest and some plugin's | expand

Commit Message

Alassane Yattara Oct. 30, 2023, 7:50 p.m. UTC
Remove load and create build environment from tests/functional/functional_helpers

Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
---
 lib/toaster/tests/functional/functional_helpers.py | 6 ------
 1 file changed, 6 deletions(-)

Comments

Tim Orling Oct. 31, 2023, 2:44 p.m. UTC | #1
On Mon, Oct 30, 2023 at 12:51 PM Alassane Yattara <
alassane.yattara@savoirfairelinux.com> wrote:

> Remove load and create build environment from
> tests/functional/functional_helpers
>
> We really need some explanation of why here. This seems like it is
crippling the whole purpose of Toaster and hence the tests: running builds.

If another commit is adding a different way of accomplishing the same
thing, then that should be documented here.

Can we not mark the class with @pytest.mark.django_db?
" Remember that you can apply marks at the single test level, the class
level, the module level, and dynamically in a hook or fixture."
https://pytest-django.readthedocs.io/en/latest/helpers.html#markers

If this code is really not needed, then an explanation of why it is not
needed should be provided.



> Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
> ---
>  lib/toaster/tests/functional/functional_helpers.py | 6 ------
>  1 file changed, 6 deletions(-)
>
> diff --git a/lib/toaster/tests/functional/functional_helpers.py
> b/lib/toaster/tests/functional/functional_helpers.py
> index c3191f66..b80d403b 100644
> --- a/lib/toaster/tests/functional/functional_helpers.py
> +++ b/lib/toaster/tests/functional/functional_helpers.py
> @@ -15,8 +15,6 @@ import time
>  import re
>
>  from tests.browser.selenium_helpers_base import SeleniumTestCaseBase
> -from tests.builds.buildtest import load_build_environment
> -from bldcontrol.models import BuildEnvironment
>  from selenium.webdriver.common.by import By
>  from selenium.common.exceptions import NoSuchElementException
>
> @@ -33,10 +31,6 @@ class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
>              raise RuntimeError("Please initialise django with the tests
> settings:  " \
>                  "DJANGO_SETTINGS_MODULE='toastermain.settings_test'")
>
> -        if BuildEnvironment.objects.count() == 0:
> -
> BuildEnvironment.objects.create(betype=BuildEnvironment.TYPE_LOCAL)
> -        load_build_environment()
> -
>          # start toaster
>          cmd = "bash -c 'source toaster start'"
>          p = subprocess.Popen(
> --
> 2.34.1
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#15327):
> https://lists.openembedded.org/g/bitbake-devel/message/15327
> Mute This Topic: https://lists.openembedded.org/mt/102283458/924729
> Group Owner: bitbake-devel+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/unsub [
> ticotimo@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/lib/toaster/tests/functional/functional_helpers.py b/lib/toaster/tests/functional/functional_helpers.py
index c3191f66..b80d403b 100644
--- a/lib/toaster/tests/functional/functional_helpers.py
+++ b/lib/toaster/tests/functional/functional_helpers.py
@@ -15,8 +15,6 @@  import time
 import re
 
 from tests.browser.selenium_helpers_base import SeleniumTestCaseBase
-from tests.builds.buildtest import load_build_environment
-from bldcontrol.models import BuildEnvironment
 from selenium.webdriver.common.by import By
 from selenium.common.exceptions import NoSuchElementException
 
@@ -33,10 +31,6 @@  class SeleniumFunctionalTestCase(SeleniumTestCaseBase):
             raise RuntimeError("Please initialise django with the tests settings:  " \
                 "DJANGO_SETTINGS_MODULE='toastermain.settings_test'")
 
-        if BuildEnvironment.objects.count() == 0:
-            BuildEnvironment.objects.create(betype=BuildEnvironment.TYPE_LOCAL)
-        load_build_environment()
-
         # start toaster
         cmd = "bash -c 'source toaster start'"
         p = subprocess.Popen(