From 45fd6b551dccc85f01061f26642614ceebf39843 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Fri, 20 Jan 2012 13:56:02 -0500 Subject: Got the test suite to pass on Python 3.2 (skipping the html5lib stuff, which doesn't seem to have Python 3 support yet.) --- bs4/tests/test_html5lib.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'bs4/tests/test_html5lib.py') diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py index 4d8dcc0..85cedbf 100644 --- a/bs4/tests/test_html5lib.py +++ b/bs4/tests/test_html5lib.py @@ -1,11 +1,19 @@ -from bs4.builder import HTML5TreeBuilder +try: + from bs4.builder import HTML5TreeBuilder + HTML5LIB_PRESENT = True +except ImportError, e: + HTML5LIB_PRESENT = False from bs4.element import Comment, SoupStrainer from test_lxml import ( TestLXMLBuilder, TestLXMLBuilderInvalidMarkup, TestLXMLBuilderEncodingConversion, ) +import unittest +@unittest.skipIf( + not HTML5LIB_PRESENT, + "html5lib seems not to be present, not testing its tree builder.") class TestHTML5Builder(TestLXMLBuilder): """See `BuilderSmokeTest`.""" @@ -73,7 +81,9 @@ class TestHTML5Builder(TestLXMLBuilder): # get a CData object. self.assertSoupEquals(markup, "") - +@unittest.skipIf( + not HTML5LIB_PRESENT, + "html5lib seems not to be present, not testing it on invalid markup.") class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup): """See `BuilderInvalidMarkupSmokeTest`.""" @@ -210,6 +220,9 @@ class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup): self.assertEquals(soup.p.string, u"\N{REPLACEMENT CHARACTER}") +@unittest.skipIf( + not HTML5LIB_PRESENT, + "html5lib seems not to be present, not testing encoding conversion.") class TestHTML5LibEncodingConversion(TestLXMLBuilderEncodingConversion): @property def default_builder(self): -- cgit v1.2.3