Skip to content

Commit 2b73979

Browse files
committed
Fix html5lib#122: Check the testdata submodule is present
1 parent 8852ff4 commit 2b73979

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

html5lib/tests/conftest.py

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import os.path
22

3+
import pytest
4+
35
from .tree_construction import TreeConstructionFile
46
from .tokenizer import TokenizerFile
57
from .sanitizer import SanitizerFile
@@ -11,9 +13,19 @@
1113
_sanitizer_testdata = os.path.join(_dir, "sanitizer-testdata")
1214

1315

14-
def pytest_collectstart():
15-
"""check to see if the git submodule has been init'd"""
16-
pass
16+
def pytest_configure(config):
17+
msgs = []
18+
if not os.path.exists(_testdata):
19+
msg = "testdata not available! "
20+
if os.path.exists(os.path.join(_dir, "..", "..", ".git")):
21+
msg += ("Please run git submodule update --init --recursive " +
22+
"and then run tests again.")
23+
else:
24+
msg += ("The testdata doesn't appear to be included with this package, " +
25+
"so finding the right version will be hard. :(")
26+
msgs.append(msg)
27+
if msgs:
28+
pytest.exit("\n".join(msgs))
1729

1830

1931
def pytest_collect_file(path, parent):

0 commit comments

Comments
 (0)