From: Akash Hadke <akash.hadke27@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Philip Lorenz <philip.lorenz@bmw.de>,
Richard Purdie <richard.purdie@linuxfoundation.org>
Subject: [poky][scarthgap][PATCH 13/23] bitbake: tests/fetch: Move commonly used imports to top
Date: Fri, 8 Aug 2025 14:19:21 +0530 [thread overview]
Message-ID: <20250808084931.2156763-13-akash.hadke27@gmail.com> (raw)
In-Reply-To: <20250808084931.2156763-1-akash.hadke27@gmail.com>
From: Philip Lorenz <philip.lorenz@bmw.de>
Avoid multiple import statements for anything that is used more than
once. Additionally, drop no longer used imports.
(Bitbake rev: 7c74310440f4d6ec47cf5bacf597e18308b3bb20)
Signed-off-by: Philip Lorenz <philip.lorenz@bmw.de>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 62c4daafcef2c920607868a0629b9bda59b61951)
Signed-off-by: Akash Hadke <akash.hadke27@gmail.com>
---
bitbake/lib/bb/tests/fetch.py | 17 ++---------------
1 file changed, 2 insertions(+), 15 deletions(-)
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index 2d0bd29799..14480d2d65 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -7,7 +7,9 @@
#
import contextlib
+import shutil
import unittest
+import urllib.parse
import hashlib
import tempfile
import collections
@@ -1250,7 +1252,6 @@ class FetcherNetworkTest(FetcherTest):
class SVNTest(FetcherTest):
def skipIfNoSvn():
- import shutil
if not shutil.which("svn"):
return unittest.skip("svn not installed, tests being skipped")
@@ -1373,7 +1374,6 @@ class TrustedNetworksTest(FetcherTest):
self.assertFalse(bb.fetch.trusted_network(self.d, url))
class URLHandle(unittest.TestCase):
-
datatable = {
"http://www.google.com/index.html" : ('http', 'www.google.com', '/index.html', '', '', {}),
"cvs://anoncvs@cvs.handhelds.org/cvs;module=familiar/dist/ipkg" : ('cvs', 'cvs.handhelds.org', '/cvs', 'anoncvs', '', {'module': 'familiar/dist/ipkg'}),
@@ -2253,7 +2253,6 @@ class GitShallowTest(FetcherTest):
class GitLfsTest(FetcherTest):
def skipIfNoGitLFS():
- import shutil
if not shutil.which('git-lfs'):
return unittest.skip('git-lfs not installed')
return lambda f: f
@@ -2373,8 +2372,6 @@ class GitLfsTest(FetcherTest):
@skipIfNoGitLFS()
def test_lfs_enabled(self):
- import shutil
-
uri = 'git://%s;protocol=file;lfs=1;branch=master' % self.srcdir
self.d.setVar('SRC_URI', uri)
@@ -2385,8 +2382,6 @@ class GitLfsTest(FetcherTest):
@skipIfNoGitLFS()
def test_lfs_disabled(self):
- import shutil
-
uri = 'git://%s;protocol=file;lfs=0;branch=master' % self.srcdir
self.d.setVar('SRC_URI', uri)
@@ -2396,8 +2391,6 @@ class GitLfsTest(FetcherTest):
fetcher.unpack(self.d.getVar('WORKDIR'))
def test_lfs_enabled_not_installed(self):
- import shutil
-
uri = 'git://%s;protocol=file;lfs=1;branch=master' % self.srcdir
self.d.setVar('SRC_URI', uri)
@@ -2418,8 +2411,6 @@ class GitLfsTest(FetcherTest):
ud.method._find_git_lfs = old_find_git_lfs
def test_lfs_disabled_not_installed(self):
- import shutil
-
uri = 'git://%s;protocol=file;lfs=0;branch=master' % self.srcdir
self.d.setVar('SRC_URI', uri)
@@ -2593,7 +2584,6 @@ class CrateTest(FetcherTest):
class NPMTest(FetcherTest):
def skipIfNoNpm():
- import shutil
if not shutil.which('npm'):
return unittest.skip('npm not installed')
return lambda f: f
@@ -3272,7 +3262,6 @@ class FetchPremirroronlyNetworkTest(FetcherTest):
self.d.setVar("PREMIRRORS", self.recipe_url + " " + "file://{}".format(self.mirrordir) + " \n")
def make_git_repo(self):
- import shutil
self.mirrorname = "git2_git.yoctoproject.org.fstests.tar.gz"
os.makedirs(self.clonedir)
self.git("clone --bare --shallow-since=\"01.01.2013\" {}".format(self.recipe_url), self.clonedir)
@@ -3301,7 +3290,6 @@ class FetchPremirroronlyMercurialTest(FetcherTest):
the test covers also basic hg:// clone (see fetch_and_create_tarball
"""
def skipIfNoHg():
- import shutil
if not shutil.which('hg'):
return unittest.skip('Mercurial not installed')
return lambda f: f
@@ -3357,7 +3345,6 @@ class FetchPremirroronlyBrokenTarball(FetcherTest):
targz.write("This is not tar.gz file!")
def test_mirror_broken_download(self):
- import sys
self.d.setVar("SRCREV", "0"*40)
fetcher = bb.fetch.Fetch([self.recipe_url], self.d)
with self.assertRaises(bb.fetch2.FetchError), self.assertLogs() as logs:
--
2.25.1
next prev parent reply other threads:[~2025-08-08 8:50 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 8:49 [poky][scarthgap][PATCH 01/23] bitbake: fetch2/git: Use git shallow fetch to implement clone_shallow_local() Akash Hadke
2025-08-08 8:49 ` [poky][scarthgap][PATCH 02/23] bitbake: bitbake: tests/fetch: Update GitShallowTest for clone_shallow_local() Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 03/23] bitbake: fetch2/git: Enforce default remote name to "origin" Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 04/23] bitbake: gitsm: Add clean function Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 05/23] bitbake: git: Clean shallow mirror tarball Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 06/23] bitbake: git: Clean broken symlink Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 07/23] bitbake: lib: Remove double imports Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 08/23] bitbake: fetch2/git: Add support for fast initial shallow fetch Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 09/23] bitbake: fetch2/gitsm: Unpack even when `ud.clonedir` is not available Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 10/23] bitbake: tests/fetch: Adapt test cases for fast shallow fetches Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 11/23] bitbake: fetch2/git: Restore escape quoting for the git url when used Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 12/23] bitbake: fetch/git: always fetch lfs when creating shallow tarball Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` Akash Hadke [this message]
2025-08-08 9:10 ` Patchtest results for [poky][scarthgap][PATCH 13/23] bitbake: tests/fetch: Move commonly used imports to top patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 14/23] bitbake: fetch2: Check for git-lfs existence before using it Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 15/23] bitbake: fetch2: Simplify git LFS detection Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 16/23] bitbake: fetch2: Use git-lfs fetch to download objects Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 17/23] bitbake: fetch2: Fix incorrect lfs parametrization for submodules Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 18/23] bitbake: fetch2: Fix LFS object checkout in submodules Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 19/23] bitbake: tests/fetch: Test gitsm with LFS Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 20/23] bitbake: fetch2/git: fix shallow clone for tag containing slash Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 21/23] bitbake: fetch2: Move the `ensure_symlink()` function into the `FetchMethod` class Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 22/23] bitbake: fetch2: Ensure a valid symlink in `PREMIRRORS` case when using shallow cloning Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-08 8:49 ` [poky][scarthgap][PATCH 23/23] bitbake: fetch2/git: Add multiple revision support Akash Hadke
2025-08-08 9:10 ` Patchtest results for " patchtest
2025-08-11 8:23 ` [OE-core] " Alexander Kanavin
[not found] ` <10458.1760096658331781386@lists.openembedded.org>
2025-10-10 12:41 ` Richard Purdie
2025-08-08 9:10 ` Patchtest results for [poky][scarthgap][PATCH 01/23] bitbake: fetch2/git: Use git shallow fetch to implement clone_shallow_local() patchtest
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=20250808084931.2156763-13-akash.hadke27@gmail.com \
--to=akash.hadke27@gmail.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=philip.lorenz@bmw.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox