Skip to content

Commit 7f022b3

Browse files
authored
TST/CLN: Remove --skip-* flags in favor of -m "not *" (#51490)
1 parent cbad73a commit 7f022b3

File tree

7 files changed

+18
-64
lines changed

7 files changed

+18
-64
lines changed

.github/workflows/wheels.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ jobs:
173173
pip install hypothesis>=6.34.2 pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17
174174
cd .. # Not a good idea to test within the src tree
175175
python -c "import pandas; print(pandas.__version__);
176-
pandas.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']);
177-
pandas.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])"
176+
pandas.test(extra_args=['-m not clipboard and not single_cpu and not slow and not network and not db', '-n 2']);
177+
pandas.test(extra_args=['-m not clipboard and single_cpu and not slow and not network and not db'])"
178178
- uses: actions/upload-artifact@v3
179179
with:
180180
name: sdist

ci/test_wheels.py

+6-13
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,13 @@
3838
else:
3939
import pandas as pd
4040

41+
multi_args = [
42+
"-m not clipboard and not single_cpu and not slow and not network and not db",
43+
"-n 2",
44+
]
45+
pd.test(extra_args=multi_args)
4146
pd.test(
4247
extra_args=[
43-
"-m not clipboard and not single_cpu",
44-
"--skip-slow",
45-
"--skip-network",
46-
"--skip-db",
47-
"-n=2",
48-
]
49-
)
50-
pd.test(
51-
extra_args=[
52-
"-m not clipboard and single_cpu",
53-
"--skip-slow",
54-
"--skip-network",
55-
"--skip-db",
48+
"-m not clipboard and single_cpu and not slow and not network and not db",
5649
]
5750
)

ci/test_wheels_windows.bat

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
set test_command=import pandas as pd; print(pd.__version__); ^
2-
pd.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']); ^
3-
pd.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])
2+
pd.test(extra_args=['-m not clipboard and not single_cpu and not slow and not network and not db', '-n 2']); ^
3+
pd.test(extra_args=['-m not clipboard and single_cpu and not slow and not network and not db'])
44

55
python --version
66
pip install pytz six numpy python-dateutil

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ installed), make sure you have `pytest
230230
::
231231

232232
>>> pd.test()
233-
running: pytest --skip-slow --skip-network --skip-db /home/user/anaconda3/lib/python3.9/site-packages/pandas
233+
running: pytest -m "not slow and not network and not db" /home/user/anaconda3/lib/python3.9/site-packages/pandas
234234

235235
============================= test session starts ==============================
236236
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0

pandas/conftest.py

-31
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,6 @@
102102

103103

104104
def pytest_addoption(parser) -> None:
105-
parser.addoption("--skip-slow", action="store_true", help="skip slow tests")
106-
parser.addoption("--skip-network", action="store_true", help="skip network tests")
107-
parser.addoption("--skip-db", action="store_true", help="skip db tests")
108-
parser.addoption(
109-
"--run-high-memory", action="store_true", help="run high memory tests"
110-
)
111-
parser.addoption("--only-slow", action="store_true", help="run only slow tests")
112105
parser.addoption(
113106
"--strict-data-files",
114107
action="store_true",
@@ -135,17 +128,6 @@ def ignore_doctest_warning(item: pytest.Item, path: str, message: str) -> None:
135128

136129

137130
def pytest_collection_modifyitems(items, config) -> None:
138-
skip_slow = config.getoption("--skip-slow")
139-
only_slow = config.getoption("--only-slow")
140-
skip_network = config.getoption("--skip-network")
141-
skip_db = config.getoption("--skip-db")
142-
143-
marks = [
144-
(pytest.mark.slow, "slow", skip_slow, "--skip-slow"),
145-
(pytest.mark.network, "network", skip_network, "--network"),
146-
(pytest.mark.db, "db", skip_db, "--skip-db"),
147-
]
148-
149131
# Warnings from doctests that can be ignored; place reason in comment above.
150132
# Each entry specifies (path, message) - see the ignore_doctest_warning function
151133
ignored_doctest_warnings = [
@@ -168,19 +150,6 @@ def pytest_collection_modifyitems(items, config) -> None:
168150
if "/frame/" in item.nodeid:
169151
item.add_marker(pytest.mark.arraymanager)
170152

171-
for mark, kwd, skip_if_found, arg_name in marks:
172-
if kwd in item.keywords:
173-
# If we're skipping, no need to actually add the marker or look for
174-
# other markers
175-
if skip_if_found:
176-
item.add_marker(pytest.mark.skip(f"skipping due to {arg_name}"))
177-
break
178-
179-
item.add_marker(mark)
180-
181-
if only_slow and "slow" not in item.keywords:
182-
item.add_marker(pytest.mark.skip("skipping due to --only-slow"))
183-
184153

185154
# Hypothesis
186155
hypothesis.settings.register_profile(

pandas/tests/extension/test_arrow.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -375,23 +375,15 @@ def test_accumulate_series(self, data, all_numeric_accumulations, skipna, reques
375375

376376
if do_skip:
377377
pytest.skip(
378-
"These should *not* work, we test in test_accumulate_series_raises "
379-
"that these correctly raise."
378+
f"{op_name} should *not* work, we test in "
379+
"test_accumulate_series_raises that these correctly raise."
380380
)
381381

382382
if all_numeric_accumulations != "cumsum" or pa_version_under9p0:
383-
if request.config.option.skip_slow:
384-
# equivalent to marking these cases with @pytest.mark.slow,
385-
# these xfails take a long time to run because pytest
386-
# renders the exception messages even when not showing them
387-
pytest.skip("pyarrow xfail slow")
383+
# xfailing takes a long time to run because pytest
384+
# renders the exception messages even when not showing them
385+
pytest.skip(f"{all_numeric_accumulations} not implemented for pyarrow < 9")
388386

389-
request.node.add_marker(
390-
pytest.mark.xfail(
391-
reason=f"{all_numeric_accumulations} not implemented",
392-
raises=NotImplementedError,
393-
)
394-
)
395387
elif all_numeric_accumulations == "cumsum" and (pa.types.is_boolean(pa_type)):
396388
request.node.add_marker(
397389
pytest.mark.xfail(

pandas/util/_tester.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test(extra_args: list[str] | None = None) -> None:
1515
"""
1616
Run the pandas test suite using pytest.
1717
18-
By default, runs with the marks --skip-slow, --skip-network, --skip-db
18+
By default, runs with the marks -m "not slow and not network and not db"
1919
2020
Parameters
2121
----------
@@ -24,7 +24,7 @@ def test(extra_args: list[str] | None = None) -> None:
2424
"""
2525
pytest = import_optional_dependency("pytest")
2626
import_optional_dependency("hypothesis")
27-
cmd = ["--skip-slow", "--skip-network", "--skip-db"]
27+
cmd = ['-m "not slow and not network and not db"']
2828
if extra_args:
2929
if not isinstance(extra_args, list):
3030
extra_args = [extra_args]

0 commit comments

Comments
 (0)