From 9662e59da44fe215659a81177a598069fecbbb73 Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Fri, 18 Oct 2019 22:13:35 -0300 Subject: [PATCH 1/8] making tests async --- pandas/tests/arrays/categorical/test_warnings.py | 6 ++++-- pandas/tests/frame/test_api.py | 6 ++++-- pandas/tests/indexes/test_base.py | 6 ++++-- pandas/tests/series/test_api.py | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pandas/tests/arrays/categorical/test_warnings.py b/pandas/tests/arrays/categorical/test_warnings.py index 53733770ed954..38816c1501464 100644 --- a/pandas/tests/arrays/categorical/test_warnings.py +++ b/pandas/tests/arrays/categorical/test_warnings.py @@ -1,17 +1,19 @@ import pytest +import asyncio import pandas as pd import pandas.util.testing as tm 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..de02668bf1785 100644 --- a/pandas/tests/frame/test_api.py +++ b/pandas/tests/frame/test_api.py @@ -4,6 +4,7 @@ import numpy as np import pytest +import asyncio import pandas as pd from pandas import ( @@ -566,13 +567,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 82d5ddd1ac358..fe13611647e58 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -7,6 +7,7 @@ import numpy as np import pytest +import asyncio import pandas._config.config as cf @@ -2413,13 +2414,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 762f4a37d17cc..8afc891c4d3a5 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -4,6 +4,7 @@ import numpy as np import pytest +import asyncio import pandas as pd from pandas import ( @@ -502,13 +503,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)) From 3465cd671b392f2e8341ed1565123e65812ca1f2 Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Fri, 18 Oct 2019 22:32:49 -0300 Subject: [PATCH 2/8] almost done --- doc/source/whatsnew/v1.0.0.rst | 1 + pandas/tests/arrays/categorical/test_warnings.py | 1 - pandas/tests/frame/test_api.py | 1 - pandas/tests/indexes/test_base.py | 1 - pandas/tests/series/test_api.py | 1 - 5 files changed, 1 insertion(+), 4 deletions(-) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index da75e2c49ae10..c0701b57d8d82 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -368,6 +368,7 @@ 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`) .. _whatsnew_1000.contributors: diff --git a/pandas/tests/arrays/categorical/test_warnings.py b/pandas/tests/arrays/categorical/test_warnings.py index 38816c1501464..5783d8e3e36fc 100644 --- a/pandas/tests/arrays/categorical/test_warnings.py +++ b/pandas/tests/arrays/categorical/test_warnings.py @@ -1,5 +1,4 @@ import pytest -import asyncio import pandas as pd import pandas.util.testing as tm diff --git a/pandas/tests/frame/test_api.py b/pandas/tests/frame/test_api.py index de02668bf1785..93f1b557328f0 100644 --- a/pandas/tests/frame/test_api.py +++ b/pandas/tests/frame/test_api.py @@ -4,7 +4,6 @@ import numpy as np import pytest -import asyncio import pandas as pd from pandas import ( diff --git a/pandas/tests/indexes/test_base.py b/pandas/tests/indexes/test_base.py index fe13611647e58..0b400ae14e0fe 100644 --- a/pandas/tests/indexes/test_base.py +++ b/pandas/tests/indexes/test_base.py @@ -7,7 +7,6 @@ import numpy as np import pytest -import asyncio import pandas._config.config as cf diff --git a/pandas/tests/series/test_api.py b/pandas/tests/series/test_api.py index 8afc891c4d3a5..fe82f8001aa67 100644 --- a/pandas/tests/series/test_api.py +++ b/pandas/tests/series/test_api.py @@ -4,7 +4,6 @@ import numpy as np import pytest -import asyncio import pandas as pd from pandas import ( From e6fa472be93b1594ca535001e40de40059ca0721 Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Tue, 22 Oct 2019 08:17:09 -0300 Subject: [PATCH 3/8] added to CI --- ci/deps/azure-36-locale_slow.yaml | 1 + ci/deps/azure-37-locale.yaml | 1 + ci/deps/travis-36-locale.yaml | 1 + environment.yml | 1 + requirements-dev.txt | 1 + 5 files changed, 5 insertions(+) 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/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/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/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 From 126380a1fe3fc6c8e245cf1cedbafd1263cf9163 Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Tue, 22 Oct 2019 09:00:48 -0300 Subject: [PATCH 4/8] fix --- ci/deps/azure-35-compat.yaml | 1 + ci/deps/azure-36-32bit.yaml | 1 + ci/deps/azure-36-locale.yaml | 1 + ci/deps/azure-37-numpydev.yaml | 1 + ci/deps/azure-macos-35.yaml | 1 + ci/deps/azure-windows-36.yaml | 1 + ci/deps/azure-windows-37.yaml | 1 + ci/deps/travis-36-cov.yaml | 1 + ci/deps/travis-36-slow.yaml | 1 + ci/deps/travis-37.yaml | 1 + 10 files changed, 10 insertions(+) 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-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-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 From 9a48c00f07e272b4e175fd1fbc0e28444e5e7805 Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Tue, 29 Oct 2019 07:55:59 -0300 Subject: [PATCH 5/8] adding to conftest.py --- pandas/conftest.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index b032e14d8f7e1..72ca1575e178f 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -8,9 +8,7 @@ from hypothesis import strategies as st import numpy as np import pytest -from pytz import FixedOffset, utc - -import pandas.util._test_decorators as td +import pytest_asyncio import pandas as pd from pandas import DataFrame From 42a73137c7852d00a2b151558aff3be6a67272e2 Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Tue, 29 Oct 2019 08:15:26 -0300 Subject: [PATCH 6/8] fix --- pandas/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 72ca1575e178f..85be6a1143ca9 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -8,7 +8,7 @@ from hypothesis import strategies as st import numpy as np import pytest -import pytest_asyncio +import asyncio import pandas as pd from pandas import DataFrame From b959e27e52bed9ef2a6d664f70773a6777bf244e Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Tue, 29 Oct 2019 08:31:24 -0300 Subject: [PATCH 7/8] testing --- pandas/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 85be6a1143ca9..83d2cfa8a6be2 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -8,7 +8,6 @@ from hypothesis import strategies as st import numpy as np import pytest -import asyncio import pandas as pd from pandas import DataFrame From 42bbbdc62abdcfd33519bcb9c5fa2980b4ec70ed Mon Sep 17 00:00:00 2001 From: gabriellm1 Date: Tue, 29 Oct 2019 08:53:20 -0300 Subject: [PATCH 8/8] testing --- pandas/conftest.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandas/conftest.py b/pandas/conftest.py index 83d2cfa8a6be2..dab1d37a36d7b 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -8,6 +8,10 @@ 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 import pandas as pd from pandas import DataFrame