summaryrefslogtreecommitdiff
path: root/bs4/tests/test_builder_registry.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2023-01-31 11:54:48 -0500
committerLeonard Richardson <leonardr@segfault.org>2023-01-31 11:54:48 -0500
commitce05e066722c926b6cd6536968911072e5cf08b0 (patch)
tree540c24e3cde04fda2e0ba25fea9be7badd7e0538 /bs4/tests/test_builder_registry.py
parent0cdcc79fb1332d6f7ac2b085ec654adfef50ac86 (diff)
Consistently use pytest.mark.skipif to skip tests when the corresponding libraries are not installed.
Diffstat (limited to 'bs4/tests/test_builder_registry.py')
-rw-r--r--bs4/tests/test_builder_registry.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/bs4/tests/test_builder_registry.py b/bs4/tests/test_builder_registry.py
index 5fa874c..9327174 100644
--- a/bs4/tests/test_builder_registry.py
+++ b/bs4/tests/test_builder_registry.py
@@ -10,22 +10,23 @@ from bs4.builder import (
TreeBuilderRegistry,
)
-try:
+from . import (
+ HTML5LIB_PRESENT,
+ LXML_PRESENT,
+)
+
+if HTML5LIB_PRESENT:
from bs4.builder import HTML5TreeBuilder
- HTML5LIB_PRESENT = True
-except ImportError:
- HTML5LIB_PRESENT = False
-try:
+if LXML_PRESENT:
from bs4.builder import (
LXMLTreeBuilderForXML,
LXMLTreeBuilder,
)
- LXML_PRESENT = True
-except ImportError:
- LXML_PRESENT = False
+# TODO: Split out the lxml and html5lib tests into their own classes
+# and gate with pytest.mark.skipIf.
class TestBuiltInRegistry(object):
"""Test the built-in registry with the default builders registered."""