Skip to content

TST/CLN: Warnings from pytest 3.1+ #16481

Closed
@TomAugspurger

Description

@TomAugspurger

New versions of pytest print a useful summary of warnings that aren't caught during the test run.
Here's a log from a couple days ago


=============================== warnings summary ===============================
pandas/tests/test_downstream.py::test_dask
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/dask/dataframe/__init__.py:3: DeprecationWarning: pandas.util.decorators is deprecated and will be removed in a future version, import from pandas.util
    from .core import (DataFrame, Series, Index, _Frame, map_partitions,

pandas/tests/test_downstream.py::test_xarray
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/xarray/core/formatting.py:16: FutureWarning: The pandas.tslib module is deprecated and will be removed in a future version.
    from pandas.tslib import OutOfBoundsDatetime

pandas/tests/test_downstream.py::test_statsmodels
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    return f(*args, **kwds)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/statsmodels/statsmodels/compat/pandas.py:62: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
    from pandas.core import datetools
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/patsy/util.py:652: DeprecationWarning: pandas.core.common.is_categorical_dtype is deprecated. import from the public API: pandas.api.types.is_categorical_dtype instead
    return safe_is_pandas_categorical_dtype(data.dtype)

pandas/tests/test_downstream.py::test_scikit_learn
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    return f(*args, **kwds)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    return f(*args, **kwds)

pandas/tests/test_downstream.py::test_seaborn
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    return f(*args, **kwds)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/ipywidgets/widgets/widget_link.py:19: DeprecationWarning: Traits should be given as instances, not types (for example, `Int()`, not `Int`) Passing types is deprecated in traitlets 4.1.
    super(WidgetTraitTuple, self).__init__(Instance(Widget), Unicode, **kwargs)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/seaborn/seaborn/categorical.py:342: DeprecationWarning: pandas.core.common.is_categorical_dtype is deprecated. import from the public API: pandas.api.types.is_categorical_dtype instead
    elif is_categorical(y):

pandas/tests/test_downstream.py::test_pandas_datareader
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas_datareader/data.py:36: ResourceWarning: unclosed <socket.socket fd=17, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.7.36', 50017), raddr=('216.58.216.100', 80)>
    return GoogleDailyReader(*args, **kwargs).read()

pandas/tests/test_downstream.py::test_geopandas
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    return f(*args, **kwds)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/fiona/drvsupport.py:143: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    ogrdrv_names = gdalenv.start().drivers().keys()
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/fiona/collection.py:145: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    self.env.__enter__()

pandas/tests/test_expressions.py::TestExpressions::()::test_integer_panel
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/panel.py:714: DeprecationWarning: 
  Panel is deprecated and will be removed in a future version.
  The recommended way to represent these types of 3-dimensional data are with a MultiIndex on a DataFrame, via the Panel.to_frame() method
  Alternatively, you can use the xarray package http://xarray.pydata.org/en/stable/.
  Pandas provides a `.to_xarray()` method to help automate this conversion.
  
    return self._combine_const(other, func)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/ops.py:1389: DeprecationWarning: 
  Panel is deprecated and will be removed in a future version.
  The recommended way to represent these types of 3-dimensional data are with a MultiIndex on a DataFrame, via the Panel.to_frame() method
  Alternatively, you can use the xarray package http://xarray.pydata.org/en/stable/.
  Pandas provides a `.to_xarray()` method to help automate this conversion.
  
    return self._combine_const(other, na_op)

pandas/tests/test_expressions.py::TestExpressions::()::test_float_panel
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/panel.py:714: DeprecationWarning: 
  Panel is deprecated and will be removed in a future version.
  The recommended way to represent these types of 3-dimensional data are with a MultiIndex on a DataFrame, via the Panel.to_frame() method
  Alternatively, you can use the xarray package http://xarray.pydata.org/en/stable/.
  Pandas provides a `.to_xarray()` method to help automate this conversion.
  
    return self._combine_const(other, func)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/ops.py:1389: DeprecationWarning: 
  Panel is deprecated and will be removed in a future version.
  The recommended way to represent these types of 3-dimensional data are with a MultiIndex on a DataFrame, via the Panel.to_frame() method
  Alternatively, you can use the xarray package http://xarray.pydata.org/en/stable/.
  Pandas provides a `.to_xarray()` method to help automate this conversion.
  
    return self._combine_const(other, na_op)

pandas/tests/test_expressions.py::TestExpressions::()::test_mixed_panel
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/panel.py:714: DeprecationWarning: 
  Panel is deprecated and will be removed in a future version.
  The recommended way to represent these types of 3-dimensional data are with a MultiIndex on a DataFrame, via the Panel.to_frame() method
  Alternatively, you can use the xarray package http://xarray.pydata.org/en/stable/.
  Pandas provides a `.to_xarray()` method to help automate this conversion.
  
    return self._combine_const(other, func)
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/ops.py:1389: DeprecationWarning: 
  Panel is deprecated and will be removed in a future version.
  The recommended way to represent these types of 3-dimensional data are with a MultiIndex on a DataFrame, via the Panel.to_frame() method
  Alternatively, you can use the xarray package http://xarray.pydata.org/en/stable/.
  Pandas provides a `.to_xarray()` method to help automate this conversion.
  
    return self._combine_const(other, na_op)

pandas/tests/dtypes/test_missing.py::test_array_equivalent_compat
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/numpy/core/numeric.py:2629: FutureWarning: elementwise == comparison failed and returning scalar instead; this will raise an error or perform elementwise comparison in the future.
    return bool(asarray(a1 == a2).all())

pandas/tests/frame/test_analytics.py::TestDataFrameAnalytics::()::test_corr_int_and_boolean
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/scipy/stats/stats.py:3577: RuntimeWarning: invalid value encountered in double_scalars
    size * (size - 1) * (size - 2))

pandas/tests/frame/test_analytics.py::TestDataFrameAnalytics::()::test_clip_mixed_numeric
  source:1893: DeprecationWarning: invalid escape sequence \d
  source:2464: DeprecationWarning: invalid escape sequence \(

pandas/tests/frame/test_operators.py::TestDataFrameOperators::()::test_boolean_comparison
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/internals.py:1153: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
    result = func(values, other)

pandas/tests/indexing/test_coercion.py::TestFillnaSeriesCoercion::()::test_fillna_series_float64
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/internals.py:4785: ComplexWarning: Casting complex values to real discards the imaginary part
    nn_at = nn.astype(v.dtype)

pandas/tests/io/test_common.py::TestCommonIOCapabilities::()::test_read_fspath_all[reader7-os-/Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/tests/io/sas/data/test1.sas7bdat]
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/importlib/_bootstrap.py:205: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
    return f(*args, **kwds)

pandas/tests/io/parser/test_network.py::TestS3::()::test_s3_fails
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/tests/io/parser/test_network.py:173: ResourceWarning: unclosed <ssl.SSLSocket fd=28, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.7.36', 50425), raddr=('54.231.33.187', 443)>
    read_csv('s3://nyqpug/asdf.csv')
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/tests/io/parser/test_network.py:173: ResourceWarning: unclosed <ssl.SSLSocket fd=27, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.7.36', 50424), raddr=('54.231.40.83', 443)>
    read_csv('s3://nyqpug/asdf.csv')

pandas/tests/plotting/test_frame.py::TestDataFramePlots::()::test_line_colors
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/plotting/_core.py:179: UserWarning: 'colors' is being deprecated. Please use 'color'instead of 'colors'
    warnings.warn(("'colors' is being deprecated. Please use 'color'"

pandas/tests/plotting/test_hist_method.py::TestDataFramePlots::()::test_tight_layout
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/tests/plotting/test_hist_method.py:249: UserWarning: To output multiple subplots, the figure containing the passed axes is being cleared
    _check_plot_works(df.hist)

pandas/tests/plotting/test_misc.py::TestDataFramePlots::()::test_parallel_coordinates_with_sorted_labels
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/matplotlib/axes/_base.py:2917: UserWarning: Attempting to set identical left==right results
  in singular transformations; automatically expanding.
  left=0, right=0
    'left=%s, right=%s') % (left, right))

pandas/tests/plotting/test_series.py::TestSeriesPlots::()::test_pie_series
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/tests/plotting/test_series.py:296: DeprecationWarning: generator 'TestSeriesPlots.test_pie_series.<locals>.<genexpr>' raised StopIteration
    expected_texts = list(next(it) for it in itertools.cycle(iters))

pandas/tests/util/test_testing.py::TestAssertAlmostEqual::()::test_assert_almost_equal_edge_case_ndarrays
  /Users/taugspurger/Envs/pandas-dev/lib/python3.6/site-packages/pandas/pandas/core/dtypes/missing.py:308: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
    return ((left == right) | (isnull(left) & isnull(right))).all()

-- Docs: http://doc.pytest.org/en/latest/warnings.html

Some of these will require updates to the test suite to just use the new behavior. Others should be explicitly caught with tm.assert_produces_warning. (I believe the downstream package warnings are already fixed in master for dask and statsmodels)

Metadata

Metadata

Assignees

No one assigned

    Labels

    CIContinuous IntegrationTestingpandas testing functions or related to the test suitegood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions