Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip test_feedparser_data if lxml_html_clean is not available #417

Merged
merged 1 commit into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 10 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,11 @@
from lxml.tests.common_imports import doctest
from lxml.doctestcompare import LHTMLOutputChecker

from lxml.html.clean import clean, Cleaner
try:
from lxml.html.clean import clean, Cleaner
html_clean_available = True
except ImportError:
html_clean_available = False

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

def test_suite():
suite = unittest.TestSuite()

if not html_clean_available:
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