From eb2b8bc7b3d90131d0863ba8442a68bd72366233 Mon Sep 17 00:00:00 2001 From: Jeffrey Tratner Date: Wed, 2 Oct 2013 23:19:24 -0400 Subject: [PATCH 1/2] Revert "Merge pull request #5058 from neurodebian/master" Was mistakenly incorporated as a fix, when in reality it was a missing skip test. This reverts commit fd3acfdb5c0530cf78abd3c17276afc94a389d60, reversing changes made to ec54354d8c09f0efc0811272655cb585fceadc58. --- pandas/io/tests/test_excel.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py index 2cc94524b5d19..0c6332205ffe5 100644 --- a/pandas/io/tests/test_excel.py +++ b/pandas/io/tests/test_excel.py @@ -21,12 +21,12 @@ import pandas as pd -def _skip_if_no_xlrd(version=(0, 9)): +def _skip_if_no_xlrd(): try: import xlrd ver = tuple(map(int, xlrd.__VERSION__.split(".")[:2])) - if ver < version: - raise nose.SkipTest('xlrd < %s, skipping' % str(version)) + if ver < (0, 9): + raise nose.SkipTest('xlrd < 0.9, skipping') except ImportError: raise nose.SkipTest('xlrd not installed, skipping') @@ -350,10 +350,7 @@ def test_excelwriter_contextmanager(self): with ExcelWriter(pth) as writer: self.frame.to_excel(writer, 'Data1') self.frame2.to_excel(writer, 'Data2') - # If above test passes with outdated xlrd, next test - # does require fresh xlrd - # http://nipy.bic.berkeley.edu/builders/pandas-py2.x-wheezy-sparc/builds/148/steps/shell_4/logs/stdio - _skip_if_no_xlrd((0, 9)) + with ExcelFile(pth) as reader: found_df = reader.parse('Data1') found_df2 = reader.parse('Data2') From 922553cea5b9f73862a417bb7d34ff56584ee0c2 Mon Sep 17 00:00:00 2001 From: Jeffrey Tratner Date: Wed, 2 Oct 2013 23:20:51 -0400 Subject: [PATCH 2/2] TST: Add skip test to excelwriter contextmanager --- pandas/io/tests/test_excel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py index 0c6332205ffe5..38b3ee192ab7a 100644 --- a/pandas/io/tests/test_excel.py +++ b/pandas/io/tests/test_excel.py @@ -343,6 +343,7 @@ def test_excel_sheet_by_name_raise(self): self.assertRaises(xlrd.XLRDError, xl.parse, '0') def test_excelwriter_contextmanager(self): + _skip_if_no_xlrd() ext = self.ext pth = os.path.join(self.dirpath, 'testit.{0}'.format(ext))