@@ -17,7 +17,7 @@ def create_socket(url, d):
def get_links_from_url(url, d):
"Return all the href links found on the web location"
- from bs4 import BeautifulSoup, SoupStrainer
+ from bb._vendor.bs4 import BeautifulSoup, SoupStrainer
soup = BeautifulSoup(create_socket(url,d), "html.parser", parse_only=SoupStrainer("a"))
hyperlinks = []
@@ -62,10 +62,6 @@ class TestOpenSUSE(TestCase):
<a href="./15.6/">15.6/</a> <a href="./16.0/">16.0/</a> <a href="./42.3/">42.3/</a>"""
def test_links_relative_to_current_directory(self):
- try:
- from bs4 import BeautifulSoup, SoupStrainer
- except ImportError:
- self.skipTest("bs4 is not available")
with mock.patch.object(oe.distro_check, "create_socket", return_value=io.BytesIO(self.LISTING)):
links = oe.distro_check.get_links_from_url("http://example.com/leap/", None)
self.assertEqual(links, ["..", "15.0-Current", "15.6", "16.0", "42.3"])
bitbake moved its bundled bs4 to bb._vendor.bs4 (4b4b9c60f "lib: Vendorize bundled third-party libraries under bb._vendor"), so "from bs4 import" only works if the host has its own bs4 installed. Without it, get_links_from_url() fails, and the selftest added in cc911c5eae ("lib/oe/distro_check: fix the openSUSE Leap package lists") skips itself. Import from bb._vendor.bs4, as bb.fetch.wget does, and drop the skip. Tested with "python3 -m unittest oeqa.selftest.cases.oelib.distro_check" on a host without bs4: the test is no longer skipped and passes. Suggested-by: Paul Barker <paul@pbarker.dev> AI-Generated: Uses Claude Code (Claude Opus 5.5) Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- meta/lib/oe/distro_check.py | 2 +- meta/lib/oeqa/selftest/cases/oelib/distro_check.py | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-)