All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
To: Richard Purdie <richard.purdie@linuxfoundation.org>
Cc: bitbake-devel <bitbake-devel@lists.openembedded.org>
Subject: Re: [bitbake-devel] [PATCH 4/4] toaster/test: Fixes functional tests warning on autobuilder
Date: Wed, 13 Dec 2023 09:13:31 -0500 (EST)	[thread overview]
Message-ID: <1058701702.76412.1702476811264.JavaMail.zimbra@savoirfairelinux.com> (raw)
In-Reply-To: <bff0319360d0af67cd0d3ecdfb4a46e84445e2ac.camel@linuxfoundation.org>

Richard,

Yes, you're right skiptest is another way, in fact I preferred this method in a testcase, 
but to avoid 2 or more skipping inside tests, I chose if condition.

Alassane
----- Mail original -----
De: "Richard Purdie" <richard.purdie@linuxfoundation.org>
À: "Alassane Yattara" <alassane.yattara@savoirfairelinux.com>, "bitbake-devel" <bitbake-devel@lists.openembedded.org>
Envoyé: Mercredi 13 Décembre 2023 14:58:24
Objet: Re: [bitbake-devel] [PATCH 4/4] toaster/test: Fixes functional tests warning on autobuilder

On Tue, 2023-12-12 at 15:17 +0100, Alassane Yattara wrote:
> tests/functional/test_project_config.py::TestProjectConfig::test_set_download_dir
>   /home/pokybuild/yocto-worker/toaster/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method TestProjectConfig.test_set_download_dir of <toaster.tests.functional.test_project_config.TestProjectConfig testMethod=test_set_download_dir>>)
>     return self.run(*args, **kwds)
> 
> tests/functional/test_project_config.py::TestProjectConfig::test_set_sstate_dir
>   /home/pokybuild/yocto-worker/toaster/build/buildtools/sysroots/x86_64-pokysdk-linux/usr/lib/python3.11/unittest/case.py:678: DeprecationWarning: It is deprecated to return a value that is not None from a test case (<bound method TestProjectConfig.test_set_sstate_dir of <toaster.tests.functional.test_project_config.TestProjectConfig testMethod=test_set_sstate_dir>>)
>     return self.run(*args, **kwds)
> 
> Signed-off-by: Alassane Yattara <alassane.yattara@savoirfairelinux.com>
> ---
>  .../tests/functional/test_project_config.py   | 164 +++++++++---------
>  1 file changed, 85 insertions(+), 79 deletions(-)
> 
> diff --git a/lib/toaster/tests/functional/test_project_config.py b/lib/toaster/tests/functional/test_project_config.py
> index 2d162d81..dbee36aa 100644
> --- a/lib/toaster/tests/functional/test_project_config.py
> +++ b/lib/toaster/tests/functional/test_project_config.py
> @@ -163,51 +163,53 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
>              change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2)
>          except TimeoutException:
>              # If download dir is not displayed, test is skipped
> -            return True
> -        change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2)
> -        change_dl_dir_btn.click()
> +            change_dl_dir_btn = None
>  
> -        # downloads dir path doesn't start with / or ${...}
> -        input_field = self.wait_until_visible('#new-dl_dir', poll=2)
> -        input_field.clear()
> -        self.enter_text('#new-dl_dir', 'home/foo')
> -        element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2)
> +        if change_dl_dir_btn:
> +            change_dl_dir_btn = self.wait_until_visible('#change-dl_dir-icon', poll=2)
> +            change_dl_dir_btn.click()
> +
> +            # downloads dir path doesn't start with / or ${...}
> +            input_field = self.wait_until_visible('#new-dl_dir', poll=2)
> +            input_field.clear()
> +            self.enter_text('#new-dl_dir', 'home/foo')
> +            element = self.wait_until_visible('#hintError-initialChar-dl_dir', poll=2)
>  
> -        msg = 'downloads directory path starts with invalid character but ' \
> -            'treated as valid'
> -        self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg)
> +            msg = 'downloads directory path starts with invalid character but ' \
> +                'treated as valid'
> +            self.assertTrue((self.INVALID_PATH_START_TEXT in element.text), msg)
>  
> -        # downloads dir path has a space
> -        self.driver.find_element(By.ID, 'new-dl_dir').clear()
> -        self.enter_text('#new-dl_dir', '/foo/bar a')
> +            # downloads dir path has a space
> +            self.driver.find_element(By.ID, 'new-dl_dir').clear()
> +            self.enter_text('#new-dl_dir', '/foo/bar a')
>  
> -        element = self.wait_until_visible('#hintError-dl_dir', poll=2)
> -        msg = 'downloads directory path characters invalid but treated as valid'
> -        self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
> +            element = self.wait_until_visible('#hintError-dl_dir', poll=2)
> +            msg = 'downloads directory path characters invalid but treated as valid'
> +            self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
>  
> -        # downloads dir path starts with ${...} but has a space
> -        self.driver.find_element(By.ID,'new-dl_dir').clear()
> -        self.enter_text('#new-dl_dir', '${TOPDIR}/down foo')
> +            # downloads dir path starts with ${...} but has a space
> +            self.driver.find_element(By.ID,'new-dl_dir').clear()
> +            self.enter_text('#new-dl_dir', '${TOPDIR}/down foo')
>  
> -        element = self.wait_until_visible('#hintError-dl_dir', poll=2)
> -        msg = 'downloads directory path characters invalid but treated as valid'
> -        self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
> +            element = self.wait_until_visible('#hintError-dl_dir', poll=2)
> +            msg = 'downloads directory path characters invalid but treated as valid'
> +            self.assertTrue((self.INVALID_PATH_CHAR_TEXT in element.text), msg)
>  
> -        # downloads dir path starts with /
> -        self.driver.find_element(By.ID,'new-dl_dir').clear()
> -        self.enter_text('#new-dl_dir', '/bar/foo')
> +            # downloads dir path starts with /
> +            self.driver.find_element(By.ID,'new-dl_dir').clear()
> +            self.enter_text('#new-dl_dir', '/bar/foo')
>  
> -        hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir')
> -        self.assertEqual(hidden_element.is_displayed(), False,
> -            'downloads directory path valid but treated as invalid')
> +            hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir')
> +            self.assertEqual(hidden_element.is_displayed(), False,
> +                'downloads directory path valid but treated as invalid')
>  
> -        # downloads dir path starts with ${...}
> -        self.driver.find_element(By.ID,'new-dl_dir').clear()
> -        self.enter_text('#new-dl_dir', '${TOPDIR}/down')
> +            # downloads dir path starts with ${...}
> +            self.driver.find_element(By.ID,'new-dl_dir').clear()
> +            self.enter_text('#new-dl_dir', '${TOPDIR}/down')
>  
> -        hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir')
> -        self.assertEqual(hidden_element.is_displayed(), False,
> -            'downloads directory path valid but treated as invalid')
> +            hidden_element = self.driver.find_element(By.ID,'hintError-dl_dir')
> +            self.assertEqual(hidden_element.is_displayed(), False,
> +                'downloads directory path valid but treated as invalid')
>  
>      def test_set_sstate_dir(self):
>          """
> @@ -217,53 +219,57 @@ class TestProjectConfig(SeleniumFunctionalTestCase):
>          self._navigate_bbv_page()
>  
>          try:
> -            self.wait_until_visible('#change-sstate_dir-icon', poll=2)
> +            btn_chg_sstate_dir = self.wait_until_visible(
> +                '#change-sstate_dir-icon',
> +                poll=2
> +            )
>              self.click('#change-sstate_dir-icon')
>          except TimeoutException:
>              # If sstate_dir is not displayed, test is skipped
> -            return True
> -

Wouldn't it be easier to do something like a self.skipTest("Some
reason") here? 

That would mean the rest of the code didn't need to change?

Cheers,

Richard



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#15660): https://lists.openembedded.org/g/bitbake-devel/message/15660
Mute This Topic: https://lists.openembedded.org/mt/103130087/7896845
Group Owner: bitbake-devel+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/bitbake-devel/leave/12674735/7896845/557127541/xyzzy [alassane.yattara@savoirfairelinux.com]
-=-=-=-=-=-=-=-=-=-=-=-


  reply	other threads:[~2023-12-13 14:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-12 14:17 [PATCH 1/4] toaster/test: bug-fix element click intercepted in browser/test_layerdetails_page.py Alassane Yattara
2023-12-12 14:17 ` [PATCH 2/4] toaster/test: Handle ProcessLookupError, log warning in console Alassane Yattara
2023-12-12 14:17 ` [PATCH 3/4] toaster/test: fix Copyright Alassane Yattara
2023-12-12 14:17 ` [PATCH 4/4] toaster/test: Fixes functional tests warning on autobuilder Alassane Yattara
2023-12-13 13:58   ` [bitbake-devel] " Richard Purdie
2023-12-13 14:13     ` Alassane Yattara [this message]
2023-12-13 14:30     ` Alassane Yattara
2023-12-12 20:21 ` [bitbake-devel] [PATCH 1/4] toaster/test: bug-fix element click intercepted in browser/test_layerdetails_page.py Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1058701702.76412.1702476811264.JavaMail.zimbra@savoirfairelinux.com \
    --to=alassane.yattara@savoirfairelinux.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=richard.purdie@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.