[Pkg-mailman-hackers] Bug#1104212: fix warnings of BeautifulSoup for hyperkitty

Fu, Rong (CN) Rong.Fu.CN at windriver.com
Sun Apr 27 10:48:12 BST 2025


Package: hyperkitty
Version: 1.3.12-3
Severity: normal

Dear Maintainer,

I'd like to submit a patch for the hyperkitty package that fixes warning for tests "test_feeds.py"

See the warnings in https://ci.debian.net/packages/h/hyperkitty/unstable/amd64/60182734/

Before the fix:

121s .............................../usr/lib/python3/dist-packages/hyperkitty/tests/test_feeds.py:68: XMLParsedAsHTMLWarning: It looks like you're using an HTML parser to parse an XML document.
121s
121s Assuming this really is an XML document, what you're doing might work, but you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the Python package 'lxml' installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
121s
121s If you want or need to use an HTML parser on this document, you can make this warning go away by filtering it. To do that, run this code before calling the BeautifulSoup constructor:
121s
121s     from bs4 import XMLParsedAsHTMLWarning
121s     import warnings
121s
121s     warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning)
121s
121s   soup = BeautifulSoup(response.content, "lxml")
122s ./usr/lib/python3/dist-packages/hyperkitty/tests/test_feeds.py:53: XMLParsedAsHTMLWarning: It looks like you're using an HTML parser to parse an XML document.
122s
122s Assuming this really is an XML document, what you're doing might work, but you should know that using an XML parser will be more reliable. To parse this document as XML, make sure you have the Python package 'lxml' installed, and pass the keyword argument `features="xml"` into the BeautifulSoup constructor.
122s
122s If you want or need to use an HTML parser on this document, you can make this warning go away by filtering it. To do that, run this code before calling the BeautifulSoup constructor:
122s
122s     from bs4 import XMLParsedAsHTMLWarning
122s     import warnings
122s
122s     warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning)
122s
122s   soup = BeautifulSoup(response.content, "lxml")
199s

With the patch, the warnings are fixed.

Thank you for considering this patch attached

Rong Fu



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-mailman-hackers/attachments/20250427/31e9cd9a/attachment.htm>


More information about the Pkg-mailman-hackers mailing list