Skip to content

Commit c66d41e

Browse files
committed
Use the nose skip plugin to actually properly skip tests.
1 parent 5ef00b1 commit c66d41e

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

html5lib/tests/support.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import glob
77
import xml.sax.handler
88

9+
from nose.plugins.skip import SkipTest
10+
911
base_path = os.path.split(__file__)[0]
1012

1113
test_dir = os.path.join(base_path, 'testdata')
@@ -182,6 +184,8 @@ def xfail(test):
182184
def t(*args, **kwargs):
183185
try:
184186
test(*args)
187+
except SkipTest:
188+
raise
185189
except:
186190
return
187191
else:

html5lib/tests/test_encoding.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
except AttributeError:
99
unittest.TestCase.assertEqual = unittest.TestCase.assertEquals
1010

11+
from nose.plugins.skip import SkipTest
12+
1113
from .support import get_data_files, TestData, test_dir, errorMessage
1214
from html5lib import HTMLParser, inputstream
1315

@@ -41,7 +43,7 @@ def runPreScanEncodingTest(data, encoding):
4143

4244
# Very crude way to ignore irrelevant tests
4345
if len(data) > stream.numBytesMeta:
44-
return
46+
raise SkipTest()
4547

4648
assert encoding == stream.charEncoding[0], errorMessage(data, encoding, stream.charEncoding[0])
4749

html5lib/tests/test_parser.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
warnings.simplefilter("error")
1010

11+
from nose.plugins.skip import SkipTest
12+
1113
from .support import get_data_files
1214
from .support import TestData, convert, convertExpected, treeTypes
1315
from .support import xfail
@@ -30,7 +32,7 @@ def runParserTest(innerHTML, input, expected, errors, treeClass,
3032
namespaceHTMLElements, scriptingDisabled):
3133
if scriptingDisabled:
3234
# We don't support the scripting disabled case!
33-
return
35+
raise SkipTest()
3436

3537
with warnings.catch_warnings(record=True) as caughtWarnings:
3638
warnings.simplefilter("always")
@@ -51,7 +53,7 @@ def runParserTest(innerHTML, input, expected, errors, treeClass,
5153
if not issubclass(x.category, constants.DataLossWarning)]
5254
assert len(otherWarnings) == 0, [(x.category, x.message) for x in otherWarnings]
5355
if len(caughtWarnings):
54-
return
56+
raise SkipTest()
5557

5658
output = convertTreeDump(p.tree.testSerializer(document))
5759

html5lib/tests/test_treewalkers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
except AttributeError:
1212
unittest.TestCase.assertEqual = unittest.TestCase.assertEquals
1313

14+
from nose.plugins.skip import SkipTest
15+
1416
from .support import get_data_files, TestData, convertExpected, xfail
1517

1618
from html5lib import html5parser, treewalkers, treebuilders, constants
@@ -253,7 +255,7 @@ def test_all_tokens(self):
253255
def runTreewalkerTest(innerHTML, input, expected, errors, treeClass, scriptingDisabled):
254256
if scriptingDisabled:
255257
# We don't support the scripting disabled case!
256-
return
258+
raise SkipTest()
257259

258260
warnings.resetwarnings()
259261
warnings.simplefilter("error")
@@ -265,7 +267,7 @@ def runTreewalkerTest(innerHTML, input, expected, errors, treeClass, scriptingDi
265267
document = p.parse(input)
266268
except constants.DataLossWarning:
267269
# Ignore testcases we know we don't pass
268-
return
270+
raise SkipTest()
269271

270272
document = treeClass.get("adapter", lambda x: x)(document)
271273
try:
@@ -282,7 +284,7 @@ def runTreewalkerTest(innerHTML, input, expected, errors, treeClass, scriptingDi
282284
"", "Diff:", diff,
283285
])
284286
except NotImplementedError:
285-
pass # Amnesty for those that confess...
287+
raise SkipTest() # Amnesty for those that confess...
286288

287289

288290
@xfail

0 commit comments

Comments
 (0)