Skip to content

Commit afbe1ed

Browse files
authored
DOC/CLN: pd.test (#46714)
1 parent bd24f67 commit afbe1ed

8 files changed

+21
-15
lines changed

ci/deps/actions-310.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

ci/deps/actions-38-downstream_compat.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ dependencies:
1010
- pytest>=6.0
1111
- pytest-cov
1212
- pytest-xdist>=1.31
13-
- hypothesis>=5.5.3
1413
- psutil
1514
- pytest-asyncio>=0.17
1615
- boto3
@@ -28,6 +27,7 @@ dependencies:
2827
- fastparquet
2928
- fsspec
3029
- html5lib
30+
- hypothesis
3131
- gcsfs
3232
- jinja2
3333
- lxml

ci/deps/actions-38-minimum_versions.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ dependencies:
1111
- pytest>=6.0
1212
- pytest-cov
1313
- pytest-xdist>=1.31
14-
- hypothesis>=5.5.3
1514
- psutil
1615
- pytest-asyncio>=0.17
1716
- boto3
@@ -29,6 +28,7 @@ dependencies:
2928
- fastparquet=0.4.0
3029
- fsspec=0.7.4
3130
- html5lib=1.1
31+
- hypothesis=5.5.3
3232
- gcsfs=0.6.0
3333
- jinja2=2.11
3434
- lxml=4.5.0

ci/deps/actions-38.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

ci/deps/actions-39.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

ci/deps/circle-38-arm64.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ dependencies:
99
- pytest>=6.0
1010
- pytest-cov
1111
- pytest-xdist>=1.31
12-
- hypothesis>=5.5.3
1312
- psutil
1413
- pytest-asyncio>=0.17
1514
- boto3
@@ -27,6 +26,7 @@ dependencies:
2726
- fastparquet
2827
- fsspec
2928
- html5lib
29+
- hypothesis
3030
- gcsfs
3131
- jinja2
3232
- lxml

pandas/compat/_optional.py

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"fastparquet": "0.4.0",
1818
"fsspec": "0.7.4",
1919
"html5lib": "1.1",
20+
"hypothesis": "5.5.3",
2021
"gcsfs": "0.6.0",
2122
"jinja2": "2.11",
2223
"lxml.etree": "4.5.0",

pandas/util/_tester.py

+14-9
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
"""
22
Entrypoint for testing from the top-level namespace.
33
"""
4+
from __future__ import annotations
5+
46
import os
57
import sys
68

9+
from pandas.compat._optional import import_optional_dependency
10+
711
PKG = os.path.dirname(os.path.dirname(__file__))
812

913

10-
def test(extra_args=None):
14+
def test(extra_args: list[str] | None = None):
1115
"""
1216
Run the pandas test suite using pytest.
17+
18+
By default, runs with the marks --skip-slow, --skip-network, --skip-db
19+
20+
Parameters
21+
----------
22+
extra_args : list[str], default None
23+
Extra marks to run the tests.
1324
"""
14-
try:
15-
import pytest
16-
except ImportError as err:
17-
raise ImportError("Need pytest>=5.0.1 to run tests") from err
18-
try:
19-
import hypothesis # noqa:F401
20-
except ImportError as err:
21-
raise ImportError("Need hypothesis>=3.58 to run tests") from err
25+
pytest = import_optional_dependency("pytest")
26+
import_optional_dependency("hypothesis")
2227
cmd = ["--skip-slow", "--skip-network", "--skip-db"]
2328
if extra_args:
2429
if not isinstance(extra_args, list):

0 commit comments

Comments
 (0)