From cd65d8eabfd671f467166ab9c47080fde2c0cec3 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Fri, 26 Oct 2018 22:29:06 -0400 Subject: [PATCH 01/16] Fix issue #22872 - Capture specific exceptions --- pandas/tests/indexing/common.py | 4 ++-- pandas/tests/io/formats/test_format.py | 4 ++-- pandas/tests/io/test_pytables.py | 8 ++++---- pandas/tests/io/test_sql.py | 6 +++--- pandas/tests/test_multilevel.py | 2 +- pandas/tests/test_nanops.py | 8 ++++---- pandas/tests/test_panel.py | 4 ++-- pandas/tests/test_strings.py | 2 +- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 127548bdaf106..7dc2c705c7531 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -151,7 +151,7 @@ def get_result(self, obj, method, key, axis): with catch_warnings(record=True): try: xp = getattr(obj, method).__getitem__(_axify(obj, key, axis)) - except: + except AttributeError: xp = getattr(obj, method).__getitem__(key) return xp @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except: + except RuntimeError: result = 'no comp' _print(result) return diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index 28aa8a92cc410..efce1edfdbbf1 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -70,7 +70,7 @@ def has_horizontally_truncated_repr(df): try: # Check header row fst_line = np.array(repr(df).splitlines()[0].split()) cand_col = np.where(fst_line == '...')[0][0] - except: + except IndexError: return False # Make sure each row has this ... in the same place r = repr(df) @@ -452,7 +452,7 @@ def test_to_string_repr_unicode(self): for line in rs[1:]: try: line = line.decode(get_option("display.encoding")) - except: + except UnicodeDecodeError: pass if not line.startswith('dtype:'): assert len(line) == line_len diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 4e9da92edcf5e..7b1bd7ccf13e1 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -51,7 +51,7 @@ def safe_remove(path): if path is not None: try: os.remove(path) - except: + except OSError: pass @@ -59,7 +59,7 @@ def safe_close(store): try: if store is not None: store.close() - except: + except IOError: pass @@ -117,7 +117,7 @@ def _maybe_remove(store, key): no content from previous tests using the same table name.""" try: store.remove(key) - except: + except ValueError: pass @@ -4621,7 +4621,7 @@ def do_copy(f, new_f=None, keys=None, safe_close(tstore) try: os.close(fd) - except: + except OSError: pass safe_remove(new_f) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index 237cc2936919e..c17930b2f3d1d 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -1790,7 +1790,7 @@ def test_read_procedure(self): try: r1 = connection.execute(proc) # noqa trans.commit() - except: + except pymysql.err.DatabaseError: trans.rollback() raise @@ -2375,7 +2375,7 @@ def setup_class(cls): # No real user should allow root access with a blank password. pymysql.connect(host='localhost', user='root', passwd='', db='pandas_nosetest') - except: + except pymysql.err.DatabaseError: pass else: return @@ -2402,7 +2402,7 @@ def setup_method(self, request, datapath): # No real user should allow root access with a blank password. self.conn = pymysql.connect(host='localhost', user='root', passwd='', db='pandas_nosetest') - except: + except pymysql.err.DatabaseError: pass else: return diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index 2022340926cca..35612a9494927 100644 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -1378,7 +1378,7 @@ def f(): try: df = f() - except: + except RuntimeError: pass assert (df['foo', 'one'] == 0).all() diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py index b06463d3c07aa..9eb2afca75508 100644 --- a/pandas/tests/test_nanops.py +++ b/pandas/tests/test_nanops.py @@ -141,12 +141,12 @@ def _coerce_tds(targ, res): if axis != 0 and hasattr( targ, 'shape') and targ.ndim and targ.shape != res.shape: res = np.split(res, [targ.shape[0]], axis=0)[0] - except: + except ValueError: targ, res = _coerce_tds(targ, res) try: tm.assert_almost_equal(targ, res, check_dtype=check_dtype) - except: + except AssertionError: # handle timedelta dtypes if hasattr(targ, 'dtype') and targ.dtype == 'm8[ns]': @@ -167,11 +167,11 @@ def _coerce_tds(targ, res): else: try: res = res.astype('c16') - except: + except RuntimeError: res = res.astype('f8') try: targ = targ.astype('c16') - except: + except RuntimeError: targ = targ.astype('f8') # there should never be a case where numpy returns an object # but nanops doesn't, so make that an exception diff --git a/pandas/tests/test_panel.py b/pandas/tests/test_panel.py index 51c779c6a97a3..a85f3f2127a84 100644 --- a/pandas/tests/test_panel.py +++ b/pandas/tests/test_panel.py @@ -335,13 +335,13 @@ def check_op(op, name): for op in ops: try: check_op(getattr(operator, op), op) - except: + except AttributeError: pprint_thing("Failing operation: %r" % op) raise if compat.PY3: try: check_op(operator.truediv, 'div') - except: + except AttributeError: pprint_thing("Failing operation: %r" % 'div') raise diff --git a/pandas/tests/test_strings.py b/pandas/tests/test_strings.py index 87bf89229a64e..75e8a14b52859 100644 --- a/pandas/tests/test_strings.py +++ b/pandas/tests/test_strings.py @@ -2629,7 +2629,7 @@ def test_slice(self): expected = Series([s[start:stop:step] if not isna(s) else NA for s in values]) tm.assert_series_equal(result, expected) - except: + except IndexError: print('failed on %s:%s:%s' % (start, stop, step)) raise From 066cdcfd6404cb22527ea098aaaf3cd6f883ebd7 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Fri, 26 Oct 2018 23:29:16 -0400 Subject: [PATCH 02/16] Some fixes --- pandas/tests/io/formats/test_format.py | 2 +- pandas/tests/test_multilevel.py | 2 +- pandas/tests/test_nanops.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/formats/test_format.py b/pandas/tests/io/formats/test_format.py index efce1edfdbbf1..12fa8146c65bf 100644 --- a/pandas/tests/io/formats/test_format.py +++ b/pandas/tests/io/formats/test_format.py @@ -452,7 +452,7 @@ def test_to_string_repr_unicode(self): for line in rs[1:]: try: line = line.decode(get_option("display.encoding")) - except UnicodeDecodeError: + except AttributeError: pass if not line.startswith('dtype:'): assert len(line) == line_len diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index 35612a9494927..e0b9a7d7d8303 100644 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -1378,7 +1378,7 @@ def f(): try: df = f() - except RuntimeError: + except ValueError: pass assert (df['foo', 'one'] == 0).all() diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py index 9eb2afca75508..49dbccb82fac8 100644 --- a/pandas/tests/test_nanops.py +++ b/pandas/tests/test_nanops.py @@ -141,7 +141,7 @@ def _coerce_tds(targ, res): if axis != 0 and hasattr( targ, 'shape') and targ.ndim and targ.shape != res.shape: res = np.split(res, [targ.shape[0]], axis=0)[0] - except ValueError: + except (ValueError, IndexError): targ, res = _coerce_tds(targ, res) try: From 318dd541b0a640c9a190b515aaae4b0b4861900b Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 00:20:59 -0400 Subject: [PATCH 03/16] Further fixes --- pandas/tests/indexing/common.py | 2 +- pandas/tests/io/test_pytables.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 7dc2c705c7531..a9f9df5d6a450 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except RuntimeError: + except (RuntimeError, AssertionError): result = 'no comp' _print(result) return diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 7b1bd7ccf13e1..6530ac5f9f1bc 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -117,7 +117,7 @@ def _maybe_remove(store, key): no content from previous tests using the same table name.""" try: store.remove(key) - except ValueError: + except (ValueError, KeyError): pass @@ -4621,7 +4621,7 @@ def do_copy(f, new_f=None, keys=None, safe_close(tstore) try: os.close(fd) - except OSError: + except (OSError, ValueError): pass safe_remove(new_f) From 677b707185cece42d90cc06a73c8c524b35cbfbf Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 01:00:28 -0400 Subject: [PATCH 04/16] Test if the problem is in common.py line 217 --- pandas/tests/indexing/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index a9f9df5d6a450..293ead736a49a 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except (RuntimeError, AssertionError): + except: result = 'no comp' _print(result) return From fa0b03b2237af8aeaacf66060a41643e1bf56cd3 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 01:33:31 -0400 Subject: [PATCH 05/16] Issue confirmed line 217 of common.py, testing exceptions --- pandas/tests/indexing/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 293ead736a49a..22e28d6a3510d 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except: + except (ValueError, IndexError): result = 'no comp' _print(result) return From 2f572977b90fdba4dfb5830fc03f75c50914fc2f Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 02:01:49 -0400 Subject: [PATCH 06/16] Working through exceptions --- pandas/tests/indexing/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 22e28d6a3510d..51f0ea1d5d771 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except (ValueError, IndexError): + except KeyError: result = 'no comp' _print(result) return From 6cca7d7d3dfc8ec80ee4fb2eb069781bcf062dd0 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 02:39:04 -0400 Subject: [PATCH 07/16] Working through exceptions --- pandas/tests/indexing/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 51f0ea1d5d771..30d6b73275fcc 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except KeyError: + except (KeyError, IndexError, ValueError, TypeError): result = 'no comp' _print(result) return From 69673232ca9585024ab13d76fb0caad9279961e0 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 03:17:20 -0400 Subject: [PATCH 08/16] Fix final bare excepts and stop ignoring E722 --- doc/source/conf.py | 6 +++--- setup.cfg | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 29f947e1144ea..e10b788ba7b22 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -565,19 +565,19 @@ def linkcode_resolve(domain, info): for part in fullname.split('.'): try: obj = getattr(obj, part) - except: + except AttributeError: return None try: fn = inspect.getsourcefile(obj) - except: + except TypeError: fn = None if not fn: return None try: source, lineno = inspect.getsourcelines(obj) - except: + except OSError: lineno = None if lineno: diff --git a/setup.cfg b/setup.cfg index a5006d66868f6..6a8bfad932099 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,7 +17,6 @@ ignore = W503, # line break before binary operator W504, # line break after binary operator E402, # module level import not at top of file - E722, # do not use bare except E731, # do not assign a lambda expression, use a def C406, # Unnecessary list literal - rewrite as a dict literal. C408, # Unnecessary dict call - rewrite as a literal. From 91c8af2e59bffa720545e382d7dddf31ae244709 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 04:15:32 -0400 Subject: [PATCH 09/16] Added assertion error to line 217 of common.py --- pandas/tests/indexing/common.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 30d6b73275fcc..74917bbaafb69 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except (KeyError, IndexError, ValueError, TypeError): + except (KeyError, IndexError, ValueError, TypeError, AssertionError): result = 'no comp' _print(result) return From 3fc44999198ece58ce293449041b972f9849d786 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 27 Oct 2018 12:52:26 -0400 Subject: [PATCH 10/16] Line 217 still problematic --- .pep8speaks.yml | 1 - pandas/tests/indexing/common.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pep8speaks.yml b/.pep8speaks.yml index ae1c92832bb15..cbcb098c47125 100644 --- a/.pep8speaks.yml +++ b/.pep8speaks.yml @@ -13,7 +13,6 @@ pycodestyle: - W503, # line break before binary operator - W504, # line break after binary operator - E402, # module level import not at top of file - - E722, # do not use bare except - E731, # do not assign a lambda expression, use a def - C406, # Unnecessary list literal - rewrite as a dict literal. - C408, # Unnecessary dict call - rewrite as a literal. diff --git a/pandas/tests/indexing/common.py b/pandas/tests/indexing/common.py index 74917bbaafb69..d21db0113cc44 100644 --- a/pandas/tests/indexing/common.py +++ b/pandas/tests/indexing/common.py @@ -214,7 +214,7 @@ def _print(result, error=None): try: xp = self.get_result(obj, method2, k2, a) - except (KeyError, IndexError, ValueError, TypeError, AssertionError): + except Exception: result = 'no comp' _print(result) return From f055a0948e586391301e9aef32a5484b87dae230 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sun, 4 Nov 2018 23:13:46 -0500 Subject: [PATCH 11/16] Update pymysql errors --- pandas/tests/io/test_sql.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index c17930b2f3d1d..e4bdceadbd411 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -1787,10 +1787,12 @@ def test_read_procedure(self): connection = self.conn.connect() trans = connection.begin() + + import pymysql try: r1 = connection.execute(proc) # noqa trans.commit() - except pymysql.err.DatabaseError: + except pymysql.Error: trans.rollback() raise @@ -2375,7 +2377,7 @@ def setup_class(cls): # No real user should allow root access with a blank password. pymysql.connect(host='localhost', user='root', passwd='', db='pandas_nosetest') - except pymysql.err.DatabaseError: + except pymysql.Error: pass else: return @@ -2402,7 +2404,7 @@ def setup_method(self, request, datapath): # No real user should allow root access with a blank password. self.conn = pymysql.connect(host='localhost', user='root', passwd='', db='pandas_nosetest') - except pymysql.err.DatabaseError: + except pymysql.Error: pass else: return From 85e1c9cd219be1b71bb6aef61c6389ac996d988d Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Thu, 8 Nov 2018 11:33:40 -0500 Subject: [PATCH 12/16] Rebase --- pandas/tests/io/test_sql.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index e4bdceadbd411..a38e3593db566 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -18,6 +18,7 @@ """ from __future__ import print_function +import pymysql import pytest import sqlite3 import csv @@ -1787,8 +1788,6 @@ def test_read_procedure(self): connection = self.conn.connect() trans = connection.begin() - - import pymysql try: r1 = connection.execute(proc) # noqa trans.commit() From 39944b64ec8e6b2c448853ac9d1ddb69a243cc7d Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Thu, 8 Nov 2018 11:39:06 -0500 Subject: [PATCH 13/16] isort Run on pandas, test_sql.py removed from setup.cfg exclusion list --- pandas/conftest.py | 4 ++-- pandas/tests/io/test_sql.py | 29 +++++++++++++++-------------- setup.cfg | 1 - 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 03e09175bdb09..7fcbdfb446ff7 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1,14 +1,14 @@ import importlib import os -import hypothesis -from hypothesis import strategies as st import numpy as np import pytest from pandas.compat import PY3 import pandas.util._test_decorators as td +import hypothesis +from hypothesis import strategies as st import pandas as pd hypothesis.settings.register_profile( diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index bb39d516a49ce..e8ff61cecddba 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -18,29 +18,30 @@ """ from __future__ import print_function -import pymysql -import pytest -import sqlite3 -import csv +import csv +from datetime import date, datetime, time +import sqlite3 import warnings + import numpy as np -import pandas as pd +import pytest -from datetime import datetime, date, time +import pandas.compat as compat +from pandas.compat import PY36, lrange, range, string_types from pandas.core.dtypes.common import ( - is_object_dtype, is_datetime64_dtype, - is_datetime64tz_dtype) -from pandas import DataFrame, Series, Index, MultiIndex, isna, concat -from pandas import date_range, to_datetime, to_timedelta, Timestamp -import pandas.compat as compat -from pandas.compat import range, lrange, string_types, PY36 + is_datetime64_dtype, is_datetime64tz_dtype, is_object_dtype) -import pandas.io.sql as sql -from pandas.io.sql import read_sql_table, read_sql_query +import pandas as pd +from pandas import ( + DataFrame, Index, MultiIndex, Series, Timestamp, concat, date_range, isna, + to_datetime, to_timedelta) import pandas.util.testing as tm +import pymysql +import pandas.io.sql as sql +from pandas.io.sql import read_sql_query, read_sql_table try: import sqlalchemy diff --git a/setup.cfg b/setup.cfg index e7f05a2211bab..cfbe4c94b4a55 100644 --- a/setup.cfg +++ b/setup.cfg @@ -205,7 +205,6 @@ skip= pandas/tests/io/test_feather.py, pandas/tests/io/test_s3.py, pandas/tests/io/test_html.py, - pandas/tests/io/test_sql.py, pandas/tests/io/test_packers.py, pandas/tests/io/test_stata.py, pandas/tests/io/conftest.py, From 48ad6f0fff92b5a4b00bc56ffb8fbdd424201756 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Thu, 8 Nov 2018 13:55:58 -0500 Subject: [PATCH 14/16] Reverted isort changes --- pandas/conftest.py | 4 ++-- pandas/tests/io/test_sql.py | 29 ++++++++++++++--------------- setup.cfg | 1 + 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 7fcbdfb446ff7..03e09175bdb09 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -1,14 +1,14 @@ import importlib import os +import hypothesis +from hypothesis import strategies as st import numpy as np import pytest from pandas.compat import PY3 import pandas.util._test_decorators as td -import hypothesis -from hypothesis import strategies as st import pandas as pd hypothesis.settings.register_profile( diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index e8ff61cecddba..bb39d516a49ce 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -18,30 +18,29 @@ """ from __future__ import print_function - -import csv -from datetime import date, datetime, time +import pymysql +import pytest import sqlite3 -import warnings +import csv +import warnings import numpy as np -import pytest +import pandas as pd -import pandas.compat as compat -from pandas.compat import PY36, lrange, range, string_types +from datetime import datetime, date, time from pandas.core.dtypes.common import ( - is_datetime64_dtype, is_datetime64tz_dtype, is_object_dtype) + is_object_dtype, is_datetime64_dtype, + is_datetime64tz_dtype) +from pandas import DataFrame, Series, Index, MultiIndex, isna, concat +from pandas import date_range, to_datetime, to_timedelta, Timestamp +import pandas.compat as compat +from pandas.compat import range, lrange, string_types, PY36 -import pandas as pd -from pandas import ( - DataFrame, Index, MultiIndex, Series, Timestamp, concat, date_range, isna, - to_datetime, to_timedelta) +import pandas.io.sql as sql +from pandas.io.sql import read_sql_table, read_sql_query import pandas.util.testing as tm -import pymysql -import pandas.io.sql as sql -from pandas.io.sql import read_sql_query, read_sql_table try: import sqlalchemy diff --git a/setup.cfg b/setup.cfg index cfbe4c94b4a55..e7f05a2211bab 100644 --- a/setup.cfg +++ b/setup.cfg @@ -205,6 +205,7 @@ skip= pandas/tests/io/test_feather.py, pandas/tests/io/test_s3.py, pandas/tests/io/test_html.py, + pandas/tests/io/test_sql.py, pandas/tests/io/test_packers.py, pandas/tests/io/test_stata.py, pandas/tests/io/conftest.py, From c55692fa82154b4aa9dae9d3cd64d83d4da1a4c2 Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Sat, 10 Nov 2018 17:06:19 -0500 Subject: [PATCH 15/16] import pymysql in the beginning of function --- pandas/tests/io/test_sql.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index bb39d516a49ce..ceffed2ddd516 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -18,7 +18,6 @@ """ from __future__ import print_function -import pymysql import pytest import sqlite3 import csv @@ -1816,6 +1815,8 @@ def test_default_type_conversion(self): assert issubclass(df.BoolColWithNull.dtype.type, np.floating) def test_read_procedure(self): + import pymysql + # see GH7324. Although it is more an api test, it is added to the # mysql tests as sqlite does not have stored procedures df = DataFrame({'a': [1, 2, 3], 'b': [0.1, 0.2, 0.3]}) From ff36b216284ea77acd6927c96468afcada78b37b Mon Sep 17 00:00:00 2001 From: Alexander Ponomaroff Date: Mon, 12 Nov 2018 23:43:23 -0500 Subject: [PATCH 16/16] Remove empty line 1819 --- pandas/tests/io/test_sql.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/tests/io/test_sql.py b/pandas/tests/io/test_sql.py index ceffed2ddd516..51cb26e546e8f 100644 --- a/pandas/tests/io/test_sql.py +++ b/pandas/tests/io/test_sql.py @@ -1816,7 +1816,6 @@ def test_default_type_conversion(self): def test_read_procedure(self): import pymysql - # see GH7324. Although it is more an api test, it is added to the # mysql tests as sqlite does not have stored procedures df = DataFrame({'a': [1, 2, 3], 'b': [0.1, 0.2, 0.3]})