From patchwork Wed Dec 6 14:44:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 35777 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 964CAC10DC1 for ; Wed, 6 Dec 2023 14:45:08 +0000 (UTC) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by mx.groups.io with SMTP id smtpd.web11.33045.1701873898382294775 for ; Wed, 06 Dec 2023 06:44:58 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Ux75JgHr; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.51, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-40c09f4814eso49862455e9.1 for ; Wed, 06 Dec 2023 06:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1701873896; x=1702478696; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=ELMe/b8cOQqlW+JgiUPMrzLGv6Oelc6p0MG9lDZ0QIE=; b=Ux75JgHr+HxJUk6oY41T1eQSqUUMkxw+SEbyIb7a5QivNqSToc2xF1iQgozbAjV5Hb ODroSdsFnakOvJ6H8QI9nh/RBtNTHnlfLHLYbZVsIUu9eM+ETdLHtLe2TwG9FomycvP+ fYaZqkBYQGHlLUYCnY14UNSpGuVv7l1RS83Pc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701873896; x=1702478696; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ELMe/b8cOQqlW+JgiUPMrzLGv6Oelc6p0MG9lDZ0QIE=; b=MSy6Bz5fuUmBtFxl5h1f16xKHI7dm5Z3cPq9N9Lrk21K6dPP8xQ+JzwD8jY4OzUZ7e lDs/ITXoSKtXXNgtMKs+AKygSN3RiSYLNbimuH3uG7oZ8YrkuhSs2Ew3Zl0U4KT266vq vMIomosKmJ8r2JUJel2K5RVuFzmnKzIwb7IxNqN8GSUp3WKpZ5VWAD6uo/Tn73aSn/97 7kSt5e48oI7mp9ZZvE4MQ2g5P3xH/XJQVMrGYpjOp+N/TrLOrD6jslmHoqxZy4xCuh+/ J4zVkBBB3RrF26WHJ9ny59kz3GtHCTB37vGw2h780iqeQaArUs5BSdXd+lWGmSff4Eph eH7g== X-Gm-Message-State: AOJu0Yy3dMVeKlBqg6cuv/LJX7YQr7EPf+2CB9Op/nApZH9rxQs7x5W4 zPCx/zT2vklfO1rPCZFBEONE+qhLqA45ZZAIJVs= X-Google-Smtp-Source: AGHT+IF1uBI6JXpLDh2isCejDZedFmxrZLaTmGOU754jHgWjK9Jn40s9xrEsEcS4qPVW7pJZFTvd8g== X-Received: by 2002:a1c:7914:0:b0:40b:5e59:ccd8 with SMTP id l20-20020a1c7914000000b0040b5e59ccd8mr822256wme.185.1701873896397; Wed, 06 Dec 2023 06:44:56 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3cca:8f76:d5f9:e02c]) by smtp.gmail.com with ESMTPSA id r12-20020a05600c458c00b0040b4b66110csm22108082wmo.22.2023.12.06.06.44.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 06:44:55 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 1/3] bb/toaster: Fix assertEquals deprecation warnings Date: Wed, 6 Dec 2023 14:44:53 +0000 Message-Id: <20231206144455.1604879-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 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 ; Wed, 06 Dec 2023 14:45:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15618 Fix: DeprecationWarning: Please use assertEqual instead Signed-off-by: Richard Purdie --- lib/bb/tests/codeparser.py | 2 +- lib/toaster/tests/browser/test_all_builds_page.py | 8 ++++---- .../tests/browser/test_builddashboard_page_artifacts.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/bb/tests/codeparser.py b/lib/bb/tests/codeparser.py index b6f2b77ee3..f6585fb3aa 100644 --- a/lib/bb/tests/codeparser.py +++ b/lib/bb/tests/codeparser.py @@ -467,6 +467,6 @@ esac # self.d.setVar("oe_libinstall", "echo test") # self.d.setVar("FOO", "foo=oe_libinstall; eval $foo") # self.d.setVarFlag("FOO", "vardeps", "oe_*") - # self.assertEquals(deps, set(["oe_libinstall"])) + # self.assertEqual(deps, set(["oe_libinstall"])) diff --git a/lib/toaster/tests/browser/test_all_builds_page.py b/lib/toaster/tests/browser/test_all_builds_page.py index 228a62be7d..bfd8f3a439 100644 --- a/lib/toaster/tests/browser/test_all_builds_page.py +++ b/lib/toaster/tests/browser/test_all_builds_page.py @@ -259,25 +259,25 @@ class TestAllBuildsPage(SeleniumTestCase): element = self._get_build_time_element(build1) links = element.find_elements(By.CSS_SELECTOR, 'a') msg = 'should be a link on the build time for a successful recent build' - self.assertEquals(len(links), 1, msg) + self.assertEqual(len(links), 1, msg) # test recent builds area for failed build element = self._get_build_time_element(build2) links = element.find_elements(By.CSS_SELECTOR, 'a') msg = 'should not be a link on the build time for a failed recent build' - self.assertEquals(len(links), 0, msg) + self.assertEqual(len(links), 0, msg) # test the time column for successful build build1_row = self._get_row_for_build(build1) links = build1_row.find_elements(By.CSS_SELECTOR, 'td.time a') msg = 'should be a link on the build time for a successful build' - self.assertEquals(len(links), 1, msg) + self.assertEqual(len(links), 1, msg) # test the time column for failed build build2_row = self._get_row_for_build(build2) links = build2_row.find_elements(By.CSS_SELECTOR, 'td.time a') msg = 'should not be a link on the build time for a failed build' - self.assertEquals(len(links), 0, msg) + self.assertEqual(len(links), 0, msg) def test_builds_table_search_box(self): """ Test the search box in the builds table on the all builds page """ diff --git a/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py b/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py index c6226d60eb..adea2edb0a 100644 --- a/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py +++ b/lib/toaster/tests/browser/test_builddashboard_page_artifacts.py @@ -197,12 +197,12 @@ class TestBuildDashboardPageArtifacts(SeleniumTestCase): # check package count and size, link on target name selector = '[data-value="target-package-count"]' element = self.find(selector) - self.assertEquals(element.text, '1', + self.assertEqual(element.text, '1', 'package count should be shown for image builds') selector = '[data-value="target-package-size"]' element = self.find(selector) - self.assertEquals(element.text, '1.0 KB', + self.assertEqual(element.text, '1.0 KB', 'package size should be shown for image builds') selector = '[data-link="target-packages"]' From patchwork Wed Dec 6 14:44:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 35778 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 96531C46CA0 for ; Wed, 6 Dec 2023 14:45:08 +0000 (UTC) Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) by mx.groups.io with SMTP id smtpd.web10.33382.1701873898997394794 for ; Wed, 06 Dec 2023 06:44:59 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=S+PWTtWa; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.46, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-40c09f4814eso49862635e9.1 for ; Wed, 06 Dec 2023 06:44:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1701873897; x=1702478697; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=852hOmjs9KgegKi4RKP/aebyr37rxk2jmHAODKUIz7k=; b=S+PWTtWauhwimN8un8o1wTO3xK8hczoIw0JQCgd9Uvxm3MZ19hsxC3UyWXpe/JS8Vj QhhcnL7kyvUxNGejdESULW6jepWLdMiDFMLfIGUUs6QxG5mSSQ+9t606JMxkM+AWgdM0 wntX3b1Ko0XYAgJE6nVdjSCoLujl6fc2CIRD4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701873897; x=1702478697; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=852hOmjs9KgegKi4RKP/aebyr37rxk2jmHAODKUIz7k=; b=MGNj5usve9gCzF4ZWllXkpeOnmrFuPMbFQPGkJO8WAIuEEhemWbzCOU3Trt2hycPOu bTEF/ho2laLNoZNSpeVfHsfZ8U2lNnaEgEStyoc45TPDTiduW5/vSIh0DIZMeRakvnNR ushMCp+Qe5+VOUG2et9XHdUPIzIv5ENLUrlBtUYfj2ccR+ISo9LakfXvbaXuU2UhE2hL zQGfcMfqdvSAksrmNaD0Qh/jf9K6UKXy7pOoIq+HTemHakxhDqjwxPVVX9uHBaDcUwF/ TeU8tzB8wPlgGtZ/uQTcUV3mSgRIRVJWc0I1CzpxhCEAT5E/CFtXFeBOiG746E8OMuZx cOEA== X-Gm-Message-State: AOJu0YxMIFWq9eCeFvimakadDfdrEgaeaRdQGiG2QC52cT6uwqhgl2A+ dXvQyrPGF2bjhPWaqnxJTfVK96vIkKC11dS0Jpw= X-Google-Smtp-Source: AGHT+IEte108F0YvsQKbeLou4Jrj0Jq1eWbWgAeUgq8mGdW3p1TIQdlBKK8J+U6x1RgZTXNjFaRlDw== X-Received: by 2002:a05:600c:524e:b0:409:1841:3f42 with SMTP id fc14-20020a05600c524e00b0040918413f42mr685195wmb.13.1701873897098; Wed, 06 Dec 2023 06:44:57 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3cca:8f76:d5f9:e02c]) by smtp.gmail.com with ESMTPSA id r12-20020a05600c458c00b0040b4b66110csm22108082wmo.22.2023.12.06.06.44.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 06:44:56 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 2/3] toaster: Fix assertRegexpMatches deprecation warnings Date: Wed, 6 Dec 2023 14:44:54 +0000 Message-Id: <20231206144455.1604879-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231206144455.1604879-1-richard.purdie@linuxfoundation.org> References: <20231206144455.1604879-1-richard.purdie@linuxfoundation.org> 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 ; Wed, 06 Dec 2023 14:45:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15619 Fix: DeprecationWarning: Please use assertRegex instead. Signed-off-by: Richard Purdie --- .../tests/browser/test_most_recent_builds_states.py | 8 ++++---- lib/toaster/tests/browser/test_new_custom_image_page.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/toaster/tests/browser/test_most_recent_builds_states.py b/lib/toaster/tests/browser/test_most_recent_builds_states.py index 949a94768a..c13d328e47 100644 --- a/lib/toaster/tests/browser/test_most_recent_builds_states.py +++ b/lib/toaster/tests/browser/test_most_recent_builds_states.py @@ -47,7 +47,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): # build queued; check shown as queued selector = base_selector + '[data-build-state="Queued"]' element = self.wait_until_visible(selector) - self.assertRegexpMatches(element.get_attribute('innerHTML'), + self.assertRegex(element.get_attribute('innerHTML'), 'Build queued', 'build should show queued status') # waiting for recipes to be parsed @@ -97,7 +97,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): selector = base_selector + '[data-build-state="Starting"]' element = self.wait_until_visible(selector) - self.assertRegexpMatches(element.get_attribute('innerHTML'), + self.assertRegex(element.get_attribute('innerHTML'), 'Tasks starting', 'build should show "tasks starting" status') # first task finished; check tasks progress bar @@ -186,7 +186,7 @@ class TestMostRecentBuildsStates(SeleniumTestCase): selector = '[data-latest-build-result="%s"] ' \ '[data-build-state="Cancelling"]' % build.id element = self.wait_until_visible(selector) - self.assertRegexpMatches(element.get_attribute('innerHTML'), + self.assertRegex(element.get_attribute('innerHTML'), 'Cancelling the build', 'build should show "cancelling" status') # check cancelled state @@ -198,5 +198,5 @@ class TestMostRecentBuildsStates(SeleniumTestCase): selector = '[data-latest-build-result="%s"] ' \ '[data-build-state="Cancelled"]' % build.id element = self.wait_until_visible(selector) - self.assertRegexpMatches(element.get_attribute('innerHTML'), + self.assertRegex(element.get_attribute('innerHTML'), 'Build cancelled', 'build should show "cancelled" status') diff --git a/lib/toaster/tests/browser/test_new_custom_image_page.py b/lib/toaster/tests/browser/test_new_custom_image_page.py index 34d1bd45c7..f4d95b1acd 100644 --- a/lib/toaster/tests/browser/test_new_custom_image_page.py +++ b/lib/toaster/tests/browser/test_new_custom_image_page.py @@ -136,7 +136,7 @@ class TestNewCustomImagePage(SeleniumTestCase): """ self._create_custom_image(self.recipe.name) element = self.wait_until_visible('#invalid-name-help') - self.assertRegexpMatches(element.text.strip(), + self.assertRegex(element.text.strip(), 'image with this name already exists') def test_new_duplicates_project_image(self): @@ -154,4 +154,4 @@ class TestNewCustomImagePage(SeleniumTestCase): self._create_custom_image(custom_image_name) element = self.wait_until_visible('#invalid-name-help') expected = 'An image with this name already exists in this project' - self.assertRegexpMatches(element.text.strip(), expected) + self.assertRegex(element.text.strip(), expected) From patchwork Wed Dec 6 14:44:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 35779 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 A58D4C10F07 for ; Wed, 6 Dec 2023 14:45:08 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.33046.1701873899844912612 for ; Wed, 06 Dec 2023 06:45:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Q5racu9i; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-40c0f3a7717so30016825e9.1 for ; Wed, 06 Dec 2023 06:44:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; t=1701873898; x=1702478698; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7kXDiw6y/3XHbTijnHx6yLn6mGzC+TAApS/iLJf6bQw=; b=Q5racu9iQLATVvxoFhl3zKpzg6D43iEVMhTB3at59yL+b/+Ln5zWHiXVL5vEBr66w1 AfYdRQ/pfz86k9sdESalGdKjNuG9APTXFnNbShZkmf8ADgc+IIOCBqFunjRE7V+/Kywk /8qeqdB3fI3Ep5dSTxEWltIjp9HWTQsycn5+s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701873898; x=1702478698; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7kXDiw6y/3XHbTijnHx6yLn6mGzC+TAApS/iLJf6bQw=; b=aLiEmRw8pGEqz8I3bieoAGCacBhlFGShNoxXiG9SEa5VLPjA3OTU/MW2YPtDIu57D8 h9zAma2pLv3XLwlu8YI7kAynNJBBeKqxcUUytmGSbHutg/YWXF3Bbq/lvfVUsbAmXkgH yyyr9MHv+IT7pdh9BFcjJLGbMN1fZ0l7vdhFn24Aq3mRBu/SPq8gRVIYsX8IRbckIwfV xSOcvGpCRwVpCAglH7H4LC0pf42/otmoVlJTkC8l2eVdC+OJymcteE4jpwrlgcR76Tiw P5CHVIUij91RFG5hFM5zS3oXY3jn5/xFy3wVlQO1+RMDtTJ88gVuGn0uOwp+uAcg9HTV E9Nw== X-Gm-Message-State: AOJu0YyTndkc1HYhJtKThw6UIaAqEWgICPR5Go/RcBkN50pQlpRf3WWe Nbo/wP21bAv/9B/gW8gKHOOtWIPaad3rCKdUYS8= X-Google-Smtp-Source: AGHT+IGz/iMKFn/sTN5i2yoTnr949CPjmjPlp55Mcdl1ls4hXkai1ZLpn/2Kzu6eT2mybjw30Av0qQ== X-Received: by 2002:a05:600c:35c7:b0:40b:5e59:f724 with SMTP id r7-20020a05600c35c700b0040b5e59f724mr335286wmq.150.1701873898117; Wed, 06 Dec 2023 06:44:58 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:3cca:8f76:d5f9:e02c]) by smtp.gmail.com with ESMTPSA id r12-20020a05600c458c00b0040b4b66110csm22108082wmo.22.2023.12.06.06.44.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 06:44:57 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 3/3] toastermain/settings: Avoid python filehandle closure warnings Date: Wed, 6 Dec 2023 14:44:55 +0000 Message-Id: <20231206144455.1604879-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231206144455.1604879-1-richard.purdie@linuxfoundation.org> References: <20231206144455.1604879-1-richard.purdie@linuxfoundation.org> 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 ; Wed, 06 Dec 2023 14:45:08 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/15620 Switch to using with blocks when accessing files to ensure file descriptors are closed and avoid python warnings. Signed-off-by: Richard Purdie --- lib/toaster/toastermain/settings.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py index 3c12359366..e06adc5a93 100644 --- a/lib/toaster/toastermain/settings.py +++ b/lib/toaster/toastermain/settings.py @@ -89,14 +89,17 @@ else: from pytz.exceptions import UnknownTimeZoneError try: if pytz.timezone(zonename) is not None: - zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename + with open(filepath, 'rb') as f: + zonefilelist[hashlib.md5(f.read()).hexdigest()] = zonename except UnknownTimeZoneError as ValueError: # we expect timezone failures here, just move over pass except ImportError: - zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename + with open(filepath, 'rb') as f: + zonefilelist[hashlib.md5(f.read()).hexdigest()] = zonename - TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime', 'rb').read()).hexdigest()] + with open('/etc/localtime', 'rb') as f: + TIME_ZONE = zonefilelist[hashlib.md5(f.read()).hexdigest()] # Language code for this installation. All choices can be found here: # http://www.i18nguy.com/unicode/language-identifiers.html