Skip to content

TST/BUG: html tests not skipping properly if lxml is not installed #7836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions pandas/io/tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,18 +595,28 @@ def _lang_enc(filename):

class TestReadHtmlEncoding(tm.TestCase):
files = glob.glob(os.path.join(DATA_PATH, 'html_encoding', '*.html'))
flavor = 'bs4'

@classmethod
def setUpClass(cls):
super(TestReadHtmlEncoding, cls).setUpClass()
_skip_if_none_of((cls.flavor, 'html5lib'))

def read_html(self, *args, **kwargs):
kwargs['flavor'] = self.flavor
return read_html(*args, **kwargs)

def read_filename(self, f, encoding):
return read_html(f, encoding=encoding, index_col=0)
return self.read_html(f, encoding=encoding, index_col=0)

def read_file_like(self, f, encoding):
with open(f, 'rb') as fobj:
return read_html(BytesIO(fobj.read()), encoding=encoding,
index_col=0)
return self.read_html(BytesIO(fobj.read()), encoding=encoding,
index_col=0)

def read_string(self, f, encoding):
with open(f, 'rb') as fobj:
return read_html(fobj.read(), encoding=encoding, index_col=0)
return self.read_html(fobj.read(), encoding=encoding, index_col=0)

def test_encode(self):
for f in self.files:
Expand All @@ -618,6 +628,15 @@ def test_encode(self):
tm.assert_frame_equal(from_string, from_filename)


class TestReadHtmlEncodingLxml(TestReadHtmlEncoding):
flavor = 'lxml'

@classmethod
def setUpClass(cls):
super(TestReadHtmlEncodingLxml, cls).setUpClass()
_skip_if_no(cls.flavor)


class TestReadHtmlLxml(tm.TestCase):
@classmethod
def setUpClass(cls):
Expand Down