Skip to content

Commit 826c728

Browse files
committed
fixup! Move to a single definition of treeTypes for all tests
1 parent fbb5ae0 commit 826c728

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

html5lib/tests/test_treewalkers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
except AttributeError:
88
unittest.TestCase.assertEqual = unittest.TestCase.assertEquals
99

10+
import pytest
11+
1012
from .support import treeTypes
1113

1214
from html5lib import html5parser, treewalkers
@@ -38,6 +40,8 @@ def test_all_tokens(self):
3840
{'type': 'EndTag', 'namespace': 'http://www.w3.org/1999/xhtml', 'name': 'html'}
3941
]
4042
for treeName, treeCls in sorted(treeTypes.items()):
43+
if treeCls is None:
44+
pytest.skip("Treebuilder not loaded")
4145
p = html5parser.HTMLParser(tree=treeCls["builder"])
4246
document = p.parse("<html><head></head><body>a<div>b</div>c</body></html>")
4347
document = treeCls.get("adapter", lambda x: x)(document)
@@ -61,6 +65,8 @@ def set_attribute_on_first_child(docfrag, name, value, treeName):
6165
def runTreewalkerEditTest(intext, expected, attrs_to_add, tree):
6266
"""tests what happens when we add attributes to the intext"""
6367
treeName, treeClass = tree
68+
if treeClass is None:
69+
pytest.skip("Treebuilder not loaded")
6470
parser = html5parser.HTMLParser(tree=treeClass["builder"])
6571
document = parser.parseFragment(intext)
6672
for nom, val in attrs_to_add:

0 commit comments

Comments
 (0)