Skip to content

Commit

Permalink
Skip test_feedparser_data if lxml_html_clean is not available
Browse files Browse the repository at this point in the history
This is useful mostly for distributors shipping lxml without
lxml_html_clean.
  • Loading branch information
frenzymadness committed Apr 4, 2024
1 parent 8509d4f commit c205689
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/lxml/html/tests/test_feedparser_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from lxml.tests.common_imports import doctest
from lxml.doctestcompare import LHTMLOutputChecker

from lxml.html.clean import clean, Cleaner

feed_dirs = [
os.path.join(os.path.dirname(__file__), 'feedparser-data'),
Expand Down Expand Up @@ -80,6 +79,12 @@ def shortDescription(self):

def test_suite():
suite = unittest.TestSuite()
try:
from lxml.html.clean import clean, Cleaner
except ImportError:
print("Skipping tests in feedparser_data - external lxml_html_clean package is not installed")
return suite

for dir in feed_dirs:
for fn in os.listdir(dir):
fn = os.path.join(dir, fn)
Expand Down

0 comments on commit c205689

Please sign in to comment.