Skip to content

Commit 31fde44

Browse files
authored
DEPS: Use ipython run_cell instead of run_code; remove pytest-asyncio (#55853)
1 parent c095a39 commit 31fde44

24 files changed

+16
-56
lines changed

.github/workflows/unit-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ jobs:
240240
. ~/virtualenvs/pandas-dev/bin/activate
241241
python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1
242242
python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
243-
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
243+
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
244244
python -m pip install --no-cache-dir --no-build-isolation -e .
245245
python -m pip list --no-cache-dir
246246
export PANDAS_CI=1
@@ -278,7 +278,7 @@ jobs:
278278
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
279279
. ~/virtualenvs/pandas-dev/bin/activate
280280
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1
281-
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
281+
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
282282
python -m pip install --no-cache-dir --no-build-isolation -e .
283283
python -m pip list --no-cache-dir
284284
@@ -351,7 +351,7 @@ jobs:
351351
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
352352
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
353353
python -m pip install versioneer[toml]
354-
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
354+
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov
355355
python -m pip install -ve . --no-build-isolation --no-index --no-deps
356356
python -m pip list
357357

.github/workflows/wheels.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ jobs:
181181
shell: pwsh
182182
run: |
183183
$TST_CMD = @"
184-
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17;
184+
python -m pip install hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0;
185185
python -m pip install `$(Get-Item pandas\wheelhouse\*.whl);
186186
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`\"\"])`';
187187
"@

ci/deps/actions-310.yaml

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

-1
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

+2-5
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

+2-6
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

+2-3
Original file line numberDiff line numberDiff line change
@@ -1243,14 +1243,13 @@ def test_cached_properties_not_settable(self):
12431243
with pytest.raises(AttributeError, match="Can't set attribute"):
12441244
index.is_unique = False
12451245

1246-
@td.async_mark()
1247-
async def test_tab_complete_warning(self, ip):
1246+
def test_tab_complete_warning(self, ip):
12481247
# https://github.com/pandas-dev/pandas/issues/16409
12491248
pytest.importorskip("IPython", minversion="6.0.0")
12501249
from IPython.core.completer import provisionalcompleter
12511250

12521251
code = "import pandas as pd; idx = pd.Index([1, 2])"
1253-
await ip.run_code(code)
1252+
ip.run_cell(code)
12541253

12551254
# GH 31324 newer jedi version raises Deprecation warning;
12561255
# appears resolved 2021-02-02

pandas/tests/resample/test_resampler_grouper.py

+2-4
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

-11
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ def test_foo():
4444
IS64,
4545
is_platform_windows,
4646
)
47-
from pandas.compat._optional import import_optional_dependency
4847

4948
from pandas.core.computation.expressions import (
5049
NUMEXPR_INSTALLED,
@@ -204,16 +203,6 @@ def documented_fixture(fixture):
204203
return documented_fixture
205204

206205

207-
def async_mark():
208-
try:
209-
import_optional_dependency("pytest_asyncio")
210-
async_mark = pytest.mark.asyncio
211-
except ImportError:
212-
async_mark = pytest.mark.skip(reason="Missing dependency pytest-asyncio")
213-
214-
return async_mark
215-
216-
217206
def mark_array_manager_not_yet_implemented(request) -> None:
218207
mark = pytest.mark.xfail(reason="Not yet implemented for ArrayManager")
219208
request.applymarker(mark)

pyproject.toml

+2-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ repository = 'https://github.com/pandas-dev/pandas'
6363
matplotlib = "pandas:plotting._matplotlib"
6464

6565
[project.optional-dependencies]
66-
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0', 'pytest-asyncio>=0.17.0']
66+
test = ['hypothesis>=6.46.1', 'pytest>=7.3.2', 'pytest-xdist>=2.2.0']
6767
performance = ['bottleneck>=1.3.6', 'numba>=0.56.4', 'numexpr>=2.8.4']
6868
computation = ['scipy>=1.10.0', 'xarray>=2022.12.0']
6969
fss = ['fsspec>=2022.11.0']
@@ -111,7 +111,6 @@ all = ['beautifulsoup4>=4.11.2',
111111
'pyreadstat>=1.2.0',
112112
'pytest>=7.3.2',
113113
'pytest-xdist>=2.2.0',
114-
'pytest-asyncio>=0.17.0',
115114
'python-calamine>=0.1.6',
116115
'pyxlsb>=1.0.10',
117116
'qtpy>=2.3.0',
@@ -154,7 +153,7 @@ setup = ['--vsenv'] # For Windows
154153
skip = "cp36-* cp37-* cp38-* pp* *_i686 *_ppc64le *_s390x *-musllinux_aarch64"
155154
build-verbosity = "3"
156155
environment = {LDFLAGS="-Wl,--strip-all"}
157-
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17"
156+
test-requires = "hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0"
158157
test-command = """
159158
PANDAS_CI='1' python -c 'import pandas as pd; \
160159
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"]); \
@@ -520,7 +519,6 @@ markers = [
520519
"arm_slow: mark a test as slow for arm64 architecture",
521520
"arraymanager: mark a test to run with ArrayManager enabled",
522521
]
523-
asyncio_mode = "strict"
524522

525523
[tool.mypy]
526524
# Import discovery

requirements-dev.txt

-1
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

-1
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

+2-4
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
'python-calamine>=0.1.6',
107106
'pyxlsb>=1.0.8',
108107
'qtpy>=2.2.0',
@@ -142,7 +141,7 @@ parentdir_prefix = "pandas-"
142141
[tool.cibuildwheel]
143142
skip = "cp36-* cp37-* pp37-* *-manylinux_i686 *_ppc64le *_s390x *-musllinux*"
144143
build-verbosity = "3"
145-
test-requires = "hypothesis>=6.34.2 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17"
144+
test-requires = "hypothesis>=6.34.2 pytest>=7.3.2 pytest-xdist>=2.2.0"
146145
test-command = "python {project}/ci/test_wheels.py"
147146

148147
[tool.cibuildwheel.macos]
@@ -386,7 +385,6 @@ markers = [
386385
"arm_slow: mark a test as slow for arm64 architecture",
387386
"arraymanager: mark a test to run with ArrayManager enabled",
388387
]
389-
asyncio_mode = "strict"
390388

391389
[tool.mypy]
392390
# Import discovery

scripts/tests/data/deps_unmodified_random.yaml

-1
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

tooling/debug/Dockerfile.pandas-debug

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ RUN python3 -m pip install \
2323
meson \
2424
meson-python \
2525
pytest \
26-
pytest-asyncio \
2726
python-dateutil \
2827
pytz \
2928
versioneer[toml]

0 commit comments

Comments
 (0)