Closed
Description
These are actually from the current version of nose
(e.g. it has a deprecation warning in inspect).
currently I have sqlalchemy
and friends not installing on 3.5 (though they can be), they are commented out in requirements-3.5.txt
So can do things like this (e.g. I did this in test_pytables.py
), until a new nose
comes out.
e.g. see #11114
expected_warning = Warning if compat.PY35 else PerformanceWarning
with tm.assert_produces_warning(expected_warning=expected_warning, check_stacklevel=False):
....
(py3.5)bash-3.2$ nosetests pandas/io/tests/test_sql.py
SSS.........................................................................S...........F.F........F..........F...........F.F........F..........F..F...................................F................................S.....................................................S/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2183: FutureWarning: write_frame is deprecated, use to_sql
sql.write_frame(frame, name='test_table', con=self.conn)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2184: FutureWarning: read_frame is deprecated, use read_sql
result = sql.read_frame("select * from test_table", self.conn)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2195: FutureWarning: write_frame is deprecated, use to_sql
sql.write_frame(frame2, name='test_table2', con=self.conn)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2197: FutureWarning: read_frame is deprecated, use read_sql
index_col='Idx')
./Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2110: FutureWarning: read_frame is deprecated, use read_sql
result = sql.read_frame("select * from test", self.conn)
./Users/jreback/miniconda/envs/py3.5/pandas/pandas/util/testing.py:1872: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
_callable(*args, **kwargs)
../Users/jreback/miniconda/envs/py3.5/pandas/pandas/util/testing.py:1872: FutureWarning: write_frame is deprecated, use to_sql
_callable(*args, **kwargs)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2285: FutureWarning: write_frame is deprecated, use to_sql
flavor='sqlite', if_exists='fail')
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2296: FutureWarning: write_frame is deprecated, use to_sql
flavor='sqlite', if_exists='replace')
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2297: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
self.assertEqual(sql.tquery(sql_select, con=self.conn),
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2300: FutureWarning: write_frame is deprecated, use to_sql
flavor='sqlite', if_exists='replace')
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2301: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
self.assertEqual(sql.tquery(sql_select, con=self.conn),
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2307: FutureWarning: write_frame is deprecated, use to_sql
flavor='sqlite', if_exists='fail')
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2308: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
self.assertEqual(sql.tquery(sql_select, con=self.conn),
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2311: FutureWarning: write_frame is deprecated, use to_sql
flavor='sqlite', if_exists='append')
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2312: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
self.assertEqual(sql.tquery(sql_select, con=self.conn),
./Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2243: FutureWarning: write_frame is deprecated, use to_sql
sql.write_frame(df, con = self.conn, name = 'testkeywords')
../Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2250: FutureWarning: write_frame is deprecated, use to_sql
sql.write_frame(mono_df, con = self.conn, name = 'mono_df')
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2257: FutureWarning: read_frame is deprecated, use read_sql
result = sql.read_frame("select * from mono_df",con_x)
../Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2205: FutureWarning: write_frame is deprecated, use to_sql
sql.write_frame(frame, name='test_table', con=self.conn)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2206: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
result = sql.tquery("select A from test_table", self.conn)
./Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2223: FutureWarning: write_frame is deprecated, use to_sql
sql.write_frame(frame, name='test_table', con=self.conn)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2225: FutureWarning: uquery is deprecated, and will be removed in future versions. You can use ``execute(...).rowcount`` instead.
self.assertEqual(sql.uquery(stmt, con=self.conn), 1)
./Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2091: FutureWarning: tquery is deprecated, and will be removed in future versions. You can use ``execute(...).fetchall()`` instead.
sql.tquery(fmt_sql, cur=cur)
/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py:2095: FutureWarning: read_frame is deprecated, use read_sql
result = sql.read_frame("select * from test", con=self.conn)
======================================================================
FAIL: test_legacy_write_frame (test_sql.TestSQLApi)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py", line 587, in test_legacy_write_frame
flavor='sqlite')
File "/Users/jreback/miniconda/envs/py3.5/lib/python3.5/contextlib.py", line 66, in __exit__
next(self.gen)
File "/Users/jreback/miniconda/envs/py3.5/pandas/pandas/util/testing.py", line 2021, in assert_produces_warning
% extra_warnings)
AssertionError: Caused unexpected warning(s): ['PendingDeprecationWarning'].
======================================================================
FAIL: test_not_reflect_all_tables (test_sql.TestSQLApi)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py", line 906, in test_not_reflect_all_tables
self.assertEqual(len(w), 0, "Warning triggered for other table")
AssertionError: 2 != 0 : Warning triggered for other table
======================================================================
FAIL: test_timedelta (test_sql.TestSQLApi)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py", line 671, in test_timedelta
df.to_sql('test_timedelta', self.conn)
File "/Users/jreback/miniconda/envs/py3.5/lib/python3.5/contextlib.py", line 66, in __exit__
next(self.gen)
File "/Users/jreback/miniconda/envs/py3.5/pandas/pandas/util/testing.py", line 2021, in assert_produces_warning
% extra_warnings)
AssertionError: Caused unexpected warning(s): ['PendingDeprecationWarning'].
======================================================================
FAIL: test_warning_case_insensitive_table_name (test_sql.TestSQLApi)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/jreback/miniconda/envs/py3.5/pandas/pandas/io/tests/test_sql.py", line 919, in test_warning_case_insensitive_table_name
self.assertEqual(len(w), 0, "Warning triggered for writing a table")
AssertionError: 1 != 0 : Warning triggered for writing a table
.....