diff --git a/linkcheck/htmlutil/htmlsoup.py b/linkcheck/htmlutil/htmlsoup.py
index 8819bc6c..d8af6a08 100644
--- a/linkcheck/htmlutil/htmlsoup.py
+++ b/linkcheck/htmlutil/htmlsoup.py
@@ -17,19 +17,27 @@
HTML parser implemented using Beautiful Soup and html.parser.
"""
-from warnings import filterwarnings
+import warnings
-filterwarnings(
+warnings.filterwarnings(
"ignore",
message="The soupsieve package is not installed. CSS selectors cannot be used.",
category=UserWarning,
module="bs4",
)
-from bs4 import BeautifulSoup
+import bs4
+
+warnings.simplefilter(
+ 'ignore', bs4.MarkupResemblesLocatorWarning
+)
+
+warnings.simplefilter(
+ 'ignore', bs4.builder.XMLParsedAsHTMLWarning
+)
def make_soup(markup, from_encoding=None):
- return BeautifulSoup(
+ return bs4.BeautifulSoup(
markup, "html.parser", from_encoding=from_encoding, multi_valued_attributes=None
)
diff --git a/pytest.ini b/pytest.ini
index f78fcd79..9a495d43 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,3 +1,6 @@
[pytest]
testpaths = tests
addopts = -ra --tb=short
+filterwarnings =
+ ignore::bs4.MarkupResemblesLocatorWarning
+ ignore::bs4.builder.XMLParsedAsHTMLWarning