From 4358393ccf030e8dcc32fd48020b32ad17678357 Mon Sep 17 00:00:00 2001 From: Alexander Kreft <akreft@trineo.org> Date: Thu, 23 Sep 2021 07:00:26 +0200 Subject: [PATCH] ENH: catch ValueError --- src/caosadvancedtools/table_importer.py | 2 +- unittests/test_table_importer.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/caosadvancedtools/table_importer.py b/src/caosadvancedtools/table_importer.py index 04c8ea23..8665eb30 100755 --- a/src/caosadvancedtools/table_importer.py +++ b/src/caosadvancedtools/table_importer.py @@ -182,7 +182,7 @@ class XLSImporter(object): """ try: xls_file = pd.io.excel.ExcelFile(filename) - except XLRDError as e: + except (XLRDError, ValueError) as e: logger.warning( "Cannot read \n{}.\nError:{}".format(filename, str(e)), diff --git a/unittests/test_table_importer.py b/unittests/test_table_importer.py index 60ca940b..bb26f503 100644 --- a/unittests/test_table_importer.py +++ b/unittests/test_table_importer.py @@ -164,7 +164,6 @@ class XLSImporterTest(unittest.TestCase): df_new = self.importer.check_unique(df) self.assertEqual(df_new.shape[0], 1) - @pytest.mark.xfail(reason="Wrong Error is raised. See Issue #52") def test_raise(self): tmp = NamedTemporaryFile(delete=False, suffix=".lol") tmp.close() -- GitLab