diff options
author | Leonard Richardson <leonardr@segfault.org> | 2023-01-31 11:54:48 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2023-01-31 11:54:48 -0500 |
commit | ce05e066722c926b6cd6536968911072e5cf08b0 (patch) | |
tree | 540c24e3cde04fda2e0ba25fea9be7badd7e0538 /bs4/tests/test_html5lib.py | |
parent | 0cdcc79fb1332d6f7ac2b085ec654adfef50ac86 (diff) |
Consistently use pytest.mark.skipif to skip tests when the corresponding libraries are not installed.
Diffstat (limited to 'bs4/tests/test_html5lib.py')
-rw-r--r-- | bs4/tests/test_html5lib.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py index de30bc8..4197720 100644 --- a/bs4/tests/test_html5lib.py +++ b/bs4/tests/test_html5lib.py @@ -1,28 +1,26 @@ """Tests to ensure that the html5lib tree builder generates good trees.""" +import pytest import warnings -try: - from bs4.builder import HTML5TreeBuilder - HTML5LIB_PRESENT = True -except ImportError as e: - HTML5LIB_PRESENT = False from bs4 import BeautifulSoup from bs4.element import SoupStrainer from . import ( + HTML5LIB_PRESENT, HTML5TreeBuilderSmokeTest, SoupTest, - skipIf, ) -@skipIf( +@pytest.mark.skipif( not HTML5LIB_PRESENT, - "html5lib seems not to be present, not testing its tree builder.") + reason="html5lib seems not to be present, not testing its tree builder." +) class TestHTML5LibBuilder(SoupTest, HTML5TreeBuilderSmokeTest): """See ``HTML5TreeBuilderSmokeTest``.""" @property def default_builder(self): + from bs4.builder import HTML5TreeBuilder return HTML5TreeBuilder def test_soupstrainer(self): |