diff --git a/ci/deps/azure-35-compat.yaml b/ci/deps/azure-35-compat.yaml index dd54001984ec7..8d6a4b0ef7a34 100644 --- a/ci/deps/azure-35-compat.yaml +++ b/ci/deps/azure-35-compat.yaml @@ -22,6 +22,7 @@ dependencies: - pytest-xdist - pytest-mock - pytest-azurepipelines + - pytest-asyncio - pip - pip: # for python 3.5, pytest>=4.0.2, cython>=0.29.13 is not available in conda diff --git a/ci/deps/azure-36-32bit.yaml b/ci/deps/azure-36-32bit.yaml index 1e2e6c33e8c15..ce4a047d89dcb 100644 --- a/ci/deps/azure-36-32bit.yaml +++ b/ci/deps/azure-36-32bit.yaml @@ -16,6 +16,7 @@ dependencies: - pytest-xdist - pytest-mock - pytest-azurepipelines + - pytest-asyncio - hypothesis>=3.58.0 - pip - pip: diff --git a/ci/deps/azure-36-locale.yaml b/ci/deps/azure-36-locale.yaml index 76868f598f11b..5e7194ec08584 100644 --- a/ci/deps/azure-36-locale.yaml +++ b/ci/deps/azure-36-locale.yaml @@ -24,6 +24,7 @@ dependencies: - pytest-xdist>=1.29.0 - pytest-mock - pytest-azurepipelines + - pytest-asyncio - hypothesis>=3.58.0 - pip - pip: diff --git a/ci/deps/azure-36-locale_slow.yaml b/ci/deps/azure-36-locale_slow.yaml index 21205375204dc..0b5961b40b32f 100644 --- a/ci/deps/azure-36-locale_slow.yaml +++ b/ci/deps/azure-36-locale_slow.yaml @@ -30,6 +30,7 @@ dependencies: - pytest-xdist - pytest-mock - pytest-azurepipelines + - pytest-asyncio - moto - pip - pip: diff --git a/ci/deps/azure-37-locale.yaml b/ci/deps/azure-37-locale.yaml index 24464adb74f5b..2fe654cec4869 100644 --- a/ci/deps/azure-37-locale.yaml +++ b/ci/deps/azure-37-locale.yaml @@ -30,6 +30,7 @@ dependencies: - pytest-xdist>=1.29.0 - pytest-mock - pytest-azurepipelines + - pytest-asyncio - pip - pip: - hypothesis>=3.58.0 diff --git a/ci/deps/azure-37-numpydev.yaml b/ci/deps/azure-37-numpydev.yaml index 0fb06fd43724c..e60d8c11c52d1 100644 --- a/ci/deps/azure-37-numpydev.yaml +++ b/ci/deps/azure-37-numpydev.yaml @@ -10,6 +10,7 @@ dependencies: - pytest>=4.0.2,<5.0 - pytest-xdist - pytest-mock + - pytest-asyncio - hypothesis>=3.58.0 - pip - pip: diff --git a/ci/deps/azure-macos-35.yaml b/ci/deps/azure-macos-35.yaml index 4e0f09904b695..f97845501038a 100644 --- a/ci/deps/azure-macos-35.yaml +++ b/ci/deps/azure-macos-35.yaml @@ -30,6 +30,7 @@ dependencies: - pytest>=5.0.1 - pytest-xdist>=1.29.0 - pytest-mock + - pytest-asyncio - hypothesis>=3.58.0 # https://github.com/pandas-dev/pandas/issues/27421 - pytest-azurepipelines<1.0.0 diff --git a/ci/deps/azure-windows-36.yaml b/ci/deps/azure-windows-36.yaml index 88b38aaef237c..eb36f6cbd9755 100644 --- a/ci/deps/azure-windows-36.yaml +++ b/ci/deps/azure-windows-36.yaml @@ -25,4 +25,5 @@ dependencies: - pytest-xdist>=1.29.0 - pytest-mock - pytest-azurepipelines + - pytest-asyncio - hypothesis>=3.58.0 diff --git a/ci/deps/azure-windows-37.yaml b/ci/deps/azure-windows-37.yaml index 7680ed9fd9c92..77eb820b695df 100644 --- a/ci/deps/azure-windows-37.yaml +++ b/ci/deps/azure-windows-37.yaml @@ -30,5 +30,6 @@ dependencies: - pytest-xdist>=1.29.0 - pytest-mock - pytest-azurepipelines + - pytest-asyncio - hypothesis>=3.58.0 - pyreadstat diff --git a/ci/deps/travis-36-cov.yaml b/ci/deps/travis-36-cov.yaml index e4e917d13990c..6e22836c4fd8b 100644 --- a/ci/deps/travis-36-cov.yaml +++ b/ci/deps/travis-36-cov.yaml @@ -43,6 +43,7 @@ dependencies: - pytest-xdist>=1.29.0 - pytest-cov - pytest-mock + - pytest-asyncio - hypothesis>=3.58.0 - pip - pip: diff --git a/ci/deps/travis-36-locale.yaml b/ci/deps/travis-36-locale.yaml index 44795766d7c31..90b4789c348e1 100644 --- a/ci/deps/travis-36-locale.yaml +++ b/ci/deps/travis-36-locale.yaml @@ -37,6 +37,7 @@ dependencies: - pytest>=5.0.1 - pytest-xdist>=1.29.0 - pytest-mock + - pytest-asyncio - pip - pip: - hypothesis>=3.58.0 diff --git a/ci/deps/travis-36-slow.yaml b/ci/deps/travis-36-slow.yaml index d54708d48a65e..fedf2fe04bb26 100644 --- a/ci/deps/travis-36-slow.yaml +++ b/ci/deps/travis-36-slow.yaml @@ -28,5 +28,6 @@ dependencies: - pytest>=5.0.0 - pytest-xdist>=1.29.0 - pytest-mock + - pytest-asyncio - moto - hypothesis>=3.58.0 diff --git a/ci/deps/travis-37.yaml b/ci/deps/travis-37.yaml index 440ca6c480b87..79e243dfc3bfc 100644 --- a/ci/deps/travis-37.yaml +++ b/ci/deps/travis-37.yaml @@ -16,6 +16,7 @@ dependencies: - pytest>=5.0.0 - pytest-xdist>=1.29.0 - pytest-mock + - pytest-asyncio - hypothesis>=3.58.0 - s3fs<0.3 - pip diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 4007ecd5a9412..90ad8b34592bd 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -443,10 +443,10 @@ Other - Bug in :meth:`Series.diff` where a boolean series would incorrectly raise a ``TypeError`` (:issue:`17294`) - :meth:`Series.append` will no longer raise a ``TypeError`` when passed a tuple of ``Series`` (:issue:`28410`) - Fix corrupted error message when calling ``pandas.libs._json.encode()`` on a 0d array (:issue:`18878`) +- Making tests async to skip IPython warnings (:issue:`29070`) - Fix :class:`AbstractHolidayCalendar` to return correct results for years after 2030 (now goes up to 2200) (:issue:`27790`) - .. _whatsnew_1000.contributors: Contributors diff --git a/environment.yml b/environment.yml index 163bd08b93c9e..462c2ad31ce55 100644 --- a/environment.yml +++ b/environment.yml @@ -53,6 +53,7 @@ dependencies: - hypothesis>=3.82 - moto # mock S3 - pytest>=4.0.2 + - pytest-asyncio - pytest-cov - pytest-mock - pytest-xdist diff --git a/pandas/conftest.py b/pandas/conftest.py index b032e14d8f7e1..dab1d37a36d7b 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -8,6 +8,7 @@ from hypothesis import strategies as st import numpy as np import pytest +import asyncio from pytz import FixedOffset, utc import pandas.util._test_decorators as td diff --git a/pandas/tests/arrays/categorical/test_warnings.py b/pandas/tests/arrays/categorical/test_warnings.py index 53733770ed954..5783d8e3e36fc 100644 --- a/pandas/tests/arrays/categorical/test_warnings.py +++ b/pandas/tests/arrays/categorical/test_warnings.py @@ -5,13 +5,14 @@ class TestCategoricalWarnings: - def test_tab_complete_warning(self, ip): + @pytest.mark.asyncio + async def test_tab_complete_warning(self, ip): # https://github.com/pandas-dev/pandas/issues/16409 pytest.importorskip("IPython", minversion="6.0.0") from IPython.core.completer import provisionalcompleter code = "import pandas as pd; c = Categorical([])" - ip.run_code(code) + await ip.run_code(code) with tm.assert_produces_warning(None): with provisionalcompleter("ignore"): list(ip.Completer.completions("c.", 1)) diff --git a/pandas/tests/frame/test_api.py b/pandas/tests/frame/test_api.py index d53a3d81ab5f8..93f1b557328f0 100644 --- a/pandas/tests/frame/test_api.py +++ b/pandas/tests/frame/test_api.py @@ -566,13 +566,14 @@ def _check_f(base, f): f = lambda x: x.rename({1: "foo"}, inplace=True) _check_f(d.copy(), f) - def test_tab_complete_warning(self, ip): + @pytest.mark.asyncio + async def test_tab_complete_warning(self, ip): # GH 16409 pytest.importorskip("IPython", minversion="6.0.0") from IPython.core.completer import provisionalcompleter code = "import pandas as pd; df = pd.DataFrame()" - ip.run_code(code) + await ip.run_code(code) with tm.assert_produces_warning(None): with provisionalcompleter("ignore"): list(ip.Completer.completions("df.", 1)) diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index 0dc6d24202c34..bb70e8485ad06 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -2411,13 +2411,14 @@ def test_get_duplicates_deprecated(self): with tm.assert_produces_warning(FutureWarning): index.get_duplicates() - def test_tab_complete_warning(self, ip): + @pytest.mark.asyncio + async def test_tab_complete_warning(self, ip): # https://github.com/pandas-dev/pandas/issues/16409 pytest.importorskip("IPython", minversion="6.0.0") from IPython.core.completer import provisionalcompleter code = "import pandas as pd; idx = pd.Index([1, 2])" - ip.run_code(code) + await ip.run_code(code) with tm.assert_produces_warning(None): with provisionalcompleter("ignore"): list(ip.Completer.completions("idx.", 4)) diff --git a/pandas/tests/series/test_api.py b/pandas/tests/series/test_api.py index f2435e8c804db..9a595df0194bf 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -504,13 +504,14 @@ def test_empty_method(self): for full_series in [pd.Series([1]), pd.Series(index=[1])]: assert not full_series.empty - def test_tab_complete_warning(self, ip): + @pytest.mark.asyncio + async def test_tab_complete_warning(self, ip): # https://github.com/pandas-dev/pandas/issues/16409 pytest.importorskip("IPython", minversion="6.0.0") from IPython.core.completer import provisionalcompleter code = "import pandas as pd; s = pd.Series()" - ip.run_code(code) + await ip.run_code(code) with tm.assert_produces_warning(None): with provisionalcompleter("ignore"): list(ip.Completer.completions("s.", 1)) diff --git a/requirements-dev.txt b/requirements-dev.txt index 8a9974d393297..a4e7c4a705292 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -31,6 +31,7 @@ botocore>=1.11 hypothesis>=3.82 moto pytest>=4.0.2 +pytest-asyncio pytest-cov pytest-mock pytest-xdist