Skip to content

Commit 7702f41

Browse files
authored
Backport PR #55853: DEPS: Use ipython run_cell instead of run_code; remove pytest-asyncio (#55858)
1 parent 0bf70c7 commit 7702f41

23 files changed

+17
-56
lines changed

.github/workflows/unit-tests.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ jobs:
236236
. ~/virtualenvs/pandas-dev/bin/activate
237237
python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1
238238
python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
239-
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
239+
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
240240
python -m pip install --no-cache-dir --no-build-isolation -e .
241241
python -m pip list --no-cache-dir
242242
export PANDAS_CI=1
@@ -274,7 +274,7 @@ jobs:
274274
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
275275
. ~/virtualenvs/pandas-dev/bin/activate
276276
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1
277-
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
277+
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
278278
python -m pip install --no-cache-dir --no-build-isolation -e .
279279
python -m pip list --no-cache-dir
280280
@@ -347,7 +347,7 @@ jobs:
347347
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
348348
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
349349
python -m pip install versioneer[toml]
350-
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov pytest-asyncio>=0.17
350+
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov
351351
python -m pip install -ve . --no-build-isolation --no-index --no-deps
352352
python -m pip list
353353

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ jobs:
168168
shell: pwsh
169169
run: |
170170
$TST_CMD = @"
171-
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17;
171+
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0;
172172
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
173173
python -c `'import pandas as pd; pd.test(extra_args=[\"`\"--no-strict-data-files`\"\", \"`\"-m not clipboard and not single_cpu and not slow and not network and not db`\"\"])`';
174174
"@

ci/deps/actions-310.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- pytest>=7.3.2
1515
- pytest-cov
1616
- pytest-xdist>=2.2.0
17-
- pytest-asyncio>=0.17.0
1817
- pytest-localserver>=0.7.1
1918
- boto3
2019

ci/deps/actions-311-downstream_compat.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies:
1515
- pytest>=7.3.2
1616
- pytest-cov
1717
- pytest-xdist>=2.2.0
18-
- pytest-asyncio>=0.17.0
1918
- pytest-localserver>=0.7.1
2019
- boto3
2120

ci/deps/actions-311-numpydev.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ dependencies:
1818
# causes an InternalError within pytest
1919
- pytest-xdist>=2.2.0, <3
2020
- hypothesis>=6.46.1
21-
- pytest-asyncio>=0.17.0
2221

2322
# pandas dependencies
2423
- python-dateutil

ci/deps/actions-311-pyarrownightly.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ dependencies:
1515
- pytest-cov
1616
- pytest-xdist>=2.2.0
1717
- hypothesis>=6.46.1
18-
- pytest-asyncio>=0.17.0
1918

2019
# required dependencies
2120
- python-dateutil

ci/deps/actions-311.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- pytest>=7.3.2
1515
- pytest-cov
1616
- pytest-xdist>=2.2.0
17-
- pytest-asyncio>=0.17.0
1817
- pytest-localserver>=0.7.1
1918
- boto3
2019

ci/deps/actions-39-minimum_versions.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ dependencies:
1616
- pytest>=7.3.2
1717
- pytest-cov
1818
- pytest-xdist>=2.2.0
19-
- pytest-asyncio>=0.17.0
2019
- pytest-localserver>=0.7.1
2120
- boto3
2221

ci/deps/actions-39.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- pytest>=7.3.2
1515
- pytest-cov
1616
- pytest-xdist>=2.2.0
17-
- pytest-asyncio>=0.17.0
1817
- pytest-localserver>=0.7.1
1918
- boto3
2019

ci/deps/actions-pypy-39.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ dependencies:
1616
# test dependencies
1717
- pytest>=7.3.2
1818
- pytest-cov
19-
- pytest-asyncio>=0.17.0
2019
- pytest-xdist>=2.2.0
2120
- hypothesis>=6.46.1
2221

ci/deps/circle-310-arm64.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- pytest>=7.3.2
1515
- pytest-cov
1616
- pytest-xdist>=2.2.0
17-
- pytest-asyncio>=0.17.0
1817
- pytest-localserver>=0.7.1
1918
- boto3
2019

ci/meta.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ test:
6464
requires:
6565
- pip
6666
- pytest >=7.3.2
67-
- pytest-asyncio >=0.17.0
6867
- pytest-xdist >=2.2.0
6968
- pytest-cov
7069
- hypothesis >=6.46.1

environment.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ dependencies:
1616
- pytest>=7.3.2
1717
- pytest-cov
1818
- pytest-xdist>=2.2.0
19-
- pytest-asyncio>=0.17.0
2019
- coverage
2120

2221
# required dependencies

pandas/tests/arrays/categorical/test_warnings.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
import pytest
22

3-
from pandas.util._test_decorators import async_mark
4-
53
import pandas._testing as tm
64

75

86
class TestCategoricalWarnings:
9-
@async_mark()
10-
async def test_tab_complete_warning(self, ip):
7+
def test_tab_complete_warning(self, ip):
118
# https://github.com/pandas-dev/pandas/issues/16409
129
pytest.importorskip("IPython", minversion="6.0.0")
1310
from IPython.core.completer import provisionalcompleter
1411

1512
code = "import pandas as pd; c = pd.Categorical([])"
16-
await ip.run_code(code)
13+
ip.run_cell(code)
1714

1815
# GH 31324 newer jedi version raises Deprecation warning;
1916
# appears resolved 2021-02-02

pandas/tests/frame/test_api.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
from pandas._config.config import option_context
99

10-
from pandas.util._test_decorators import async_mark
11-
1210
import pandas as pd
1311
from pandas import (
1412
DataFrame,
@@ -288,8 +286,7 @@ def _check_f(base, f):
288286
f = lambda x: x.rename({1: "foo"}, inplace=True)
289287
_check_f(d.copy(), f)
290288

291-
@async_mark()
292-
async def test_tab_complete_warning(self, ip, frame_or_series):
289+
def test_tab_complete_warning(self, ip, frame_or_series):
293290
# GH 16409
294291
pytest.importorskip("IPython", minversion="6.0.0")
295292
from IPython.core.completer import provisionalcompleter
@@ -299,8 +296,7 @@ async def test_tab_complete_warning(self, ip, frame_or_series):
299296
else:
300297
code = "from pandas import Series; obj = Series(dtype=object)"
301298

302-
await ip.run_code(code)
303-
299+
ip.run_cell(code)
304300
# GH 31324 newer jedi version raises Deprecation warning;
305301
# appears resolved 2021-02-02
306302
with tm.assert_produces_warning(None, raise_on_extra_warnings=False):

pandas/tests/indexes/test_base.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
from pandas.compat import IS64
1212
from pandas.errors import InvalidIndexError
13-
from pandas.util._test_decorators import async_mark
1413

1514
from pandas.core.dtypes.common import (
1615
is_any_real_numeric_dtype,
@@ -1218,14 +1217,13 @@ def test_cached_properties_not_settable(self):
12181217
with pytest.raises(AttributeError, match="Can't set attribute"):
12191218
index.is_unique = False
12201219

1221-
@async_mark()
1222-
async def test_tab_complete_warning(self, ip):
1220+
def test_tab_complete_warning(self, ip):
12231221
# https://github.com/pandas-dev/pandas/issues/16409
12241222
pytest.importorskip("IPython", minversion="6.0.0")
12251223
from IPython.core.completer import provisionalcompleter
12261224

12271225
code = "import pandas as pd; idx = pd.Index([1, 2])"
1228-
await ip.run_code(code)
1226+
ip.run_cell(code)
12291227

12301228
# GH 31324 newer jedi version raises Deprecation warning;
12311229
# appears resolved 2021-02-02

pandas/tests/resample/test_resampler_grouper.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pytest
55

66
from pandas.compat import is_platform_windows
7-
from pandas.util._test_decorators import async_mark
87

98
import pandas as pd
109
from pandas import (
@@ -26,8 +25,7 @@ def test_frame():
2625
)
2726

2827

29-
@async_mark()
30-
async def test_tab_complete_ipython6_warning(ip):
28+
def test_tab_complete_ipython6_warning(ip):
3129
from IPython.core.completer import provisionalcompleter
3230

3331
code = dedent(
@@ -37,7 +35,7 @@ async def test_tab_complete_ipython6_warning(ip):
3735
rs = s.resample("D")
3836
"""
3937
)
40-
await ip.run_code(code)
38+
ip.run_cell(code)
4139

4240
# GH 31324 newer jedi version raises Deprecation warning;
4341
# appears resolved 2021-02-02

pandas/util/_test_decorators.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ def test_foo():
3838

3939
if TYPE_CHECKING:
4040
from pandas._typing import F
41+
4142
from pandas.compat import (
4243
IS64,
4344
is_platform_windows,
4445
)
45-
from pandas.compat._optional import import_optional_dependency
4646

4747
from pandas.core.computation.expressions import (
4848
NUMEXPR_INSTALLED,
@@ -214,16 +214,6 @@ def documented_fixture(fixture):
214214
return documented_fixture
215215

216216

217-
def async_mark():
218-
try:
219-
import_optional_dependency("pytest_asyncio")
220-
async_mark = pytest.mark.asyncio
221-
except ImportError:
222-
async_mark = pytest.mark.skip(reason="Missing dependency pytest-asyncio")
223-
224-
return async_mark
225-
226-
227217
def mark_array_manager_not_yet_implemented(request) -> None:
228218
mark = pytest.mark.xfail(reason="Not yet implemented for ArrayManager")
229219
request.node.add_marker(mark)

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ repository = 'https://github.com/pandas-dev/pandas'
6161
matplotlib = "pandas:plotting._matplotlib"
6262

6363
[project.optional-dependencies]
64-
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0', 'pytest-asyncio>=0.17.0']
64+
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0']
6565
performance = ['bottleneck>=1.3.4', 'numba>=0.55.2', 'numexpr>=2.8.0']
6666
computation = ['scipy>=1.8.1', 'xarray>=2022.03.0']
6767
fss = ['fsspec>=2022.05.0']
@@ -109,7 +109,6 @@ all = ['beautifulsoup4>=4.11.1',
109109
'pyreadstat>=1.1.5',
110110
'pytest>=7.3.2',
111111
'pytest-xdist>=2.2.0',
112-
'pytest-asyncio>=0.17.0',
113112
'pyxlsb>=1.0.9',
114113
'qtpy>=2.2.0',
115114
'scipy>=1.8.1',
@@ -151,7 +150,7 @@ setup = ['--vsenv'] # For Windows
151150
skip = "cp36-* cp37-* cp38-* pp* *_i686 *_ppc64le *_s390x *-musllinux_aarch64"
152151
build-verbosity = "3"
153152
environment = {LDFLAGS="-Wl,--strip-all"}
154-
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17"
153+
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0"
155154
test-command = """
156155
PANDAS_CI='1' python -c 'import pandas as pd; \
157156
pd.test(extra_args=["-m not clipboard and not single_cpu and not slow and not network and not db", "-n 2", "--no-strict-data-files"]); \
@@ -514,7 +513,6 @@ markers = [
514513
"arm_slow: mark a test as slow for arm64 architecture",
515514
"arraymanager: mark a test to run with ArrayManager enabled",
516515
]
517-
asyncio_mode = "strict"
518516

519517
[tool.mypy]
520518
# Import discovery

requirements-dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ meson-python==0.13.1
99
pytest>=7.3.2
1010
pytest-cov
1111
pytest-xdist>=2.2.0
12-
pytest-asyncio>=0.17.0
1312
coverage
1413
python-dateutil
1514
numpy<2

scripts/tests/data/deps_expected_random.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- pytest-cov
1515
- pytest-xdist>=2.2.0
1616
- psutil
17-
- pytest-asyncio>=0.17.0
1817
- boto3
1918

2019
# required dependencies

scripts/tests/data/deps_minimum.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ repository = 'https://github.com/pandas-dev/pandas'
5555
matplotlib = "pandas:plotting._matplotlib"
5656

5757
[project.optional-dependencies]
58-
test = ['hypothesis>=6.34.2', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0', 'pytest-asyncio>=0.17.0']
58+
test = ['hypothesis>=6.34.2', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0']
5959
performance = ['bottleneck>=1.3.2', 'numba>=0.53.1', 'numexpr>=2.7.1']
6060
timezone = ['tzdata>=2022.1']
6161
computation = ['scipy>=1.7.1', 'xarray>=0.21.0']
@@ -102,7 +102,6 @@ all = ['beautifulsoup4>=5.9.3',
102102
'pyreadstat>=1.1.2',
103103
'pytest>=7.3.2',
104104
'pytest-xdist>=2.2.0',
105-
'pytest-asyncio>=0.17.0',
106105
'pyxlsb>=1.0.8',
107106
'qtpy>=2.2.0',
108107
'scipy>=1.7.1',
@@ -141,7 +140,7 @@ parentdir_prefix = "pandas-"
141140
[tool.cibuildwheel]
142141
skip = "cp36-* cp37-* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux*"
143142
build-verbosity = "3"
144-
test-requires = "hypothesis>=6.34.2 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17"
143+
test-requires = "hypothesis>=6.34.2 pytest>=7.3.2 pytest-xdist>=2.2.0"
145144
test-command = "python {project}/ci/test_wheels.py"
146145

147146
[tool.cibuildwheel.macos]
@@ -385,7 +384,6 @@ markers = [
385384
"arm_slow: mark a test as slow for arm64 architecture",
386385
"arraymanager: mark a test to run with ArrayManager enabled",
387386
]
388-
asyncio_mode = "strict"
389387

390388
[tool.mypy]
391389
# Import discovery

scripts/tests/data/deps_unmodified_random.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ dependencies:
1414
- pytest-cov
1515
- pytest-xdist>=2.2.0
1616
- psutil
17-
- pytest-asyncio>=0.17
1817
- boto3
1918

2019
# required dependencies

0 commit comments

Comments
 (0)