Skip to content

TST/CLN: Remove --skip-* flags in favor of -m "not *" #51490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ jobs:
pip install hypothesis>=6.34.2 pytest>=7.0.0 pytest-xdist>=2.2.0 pytest-asyncio>=0.17
cd .. # Not a good idea to test within the src tree
python -c "import pandas; print(pandas.__version__);
pandas.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']);
pandas.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])"
pandas.test(extra_args=['-m not clipboard and not single_cpu and not slow and not network and not db', '-n 2']);
pandas.test(extra_args=['-m not clipboard and single_cpu and not slow and not network and not db'])"
- uses: actions/upload-artifact@v3
with:
name: sdist
Expand Down
19 changes: 6 additions & 13 deletions ci/test_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,13 @@
else:
import pandas as pd

multi_args = [
"-m not clipboard and not single_cpu and not slow and not network and not db",
"-n 2",
]
pd.test(extra_args=multi_args)
pd.test(
extra_args=[
"-m not clipboard and not single_cpu",
"--skip-slow",
"--skip-network",
"--skip-db",
"-n=2",
]
)
pd.test(
extra_args=[
"-m not clipboard and single_cpu",
"--skip-slow",
"--skip-network",
"--skip-db",
"-m not clipboard and single_cpu and not slow and not network and not db",
]
)
4 changes: 2 additions & 2 deletions ci/test_wheels_windows.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set test_command=import pandas as pd; print(pd.__version__); ^
pd.test(extra_args=['-m not clipboard and not single_cpu', '--skip-slow', '--skip-network', '--skip-db', '-n=2']); ^
pd.test(extra_args=['-m not clipboard and single_cpu', '--skip-slow', '--skip-network', '--skip-db'])
pd.test(extra_args=['-m not clipboard and not single_cpu and not slow and not network and not db', '-n 2']); ^
pd.test(extra_args=['-m not clipboard and single_cpu and not slow and not network and not db'])

python --version
pip install pytz six numpy python-dateutil
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ installed), make sure you have `pytest
::

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

============================= test session starts ==============================
platform linux -- Python 3.9.7, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
Expand Down
31 changes: 0 additions & 31 deletions pandas/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@


def pytest_addoption(parser) -> None:
parser.addoption("--skip-slow", action="store_true", help="skip slow tests")
parser.addoption("--skip-network", action="store_true", help="skip network tests")
parser.addoption("--skip-db", action="store_true", help="skip db tests")
parser.addoption(
"--run-high-memory", action="store_true", help="run high memory tests"
)
parser.addoption("--only-slow", action="store_true", help="run only slow tests")
parser.addoption(
"--strict-data-files",
action="store_true",
Expand All @@ -135,17 +128,6 @@ def ignore_doctest_warning(item: pytest.Item, path: str, message: str) -> None:


def pytest_collection_modifyitems(items, config) -> None:
skip_slow = config.getoption("--skip-slow")
only_slow = config.getoption("--only-slow")
skip_network = config.getoption("--skip-network")
skip_db = config.getoption("--skip-db")

marks = [
(pytest.mark.slow, "slow", skip_slow, "--skip-slow"),
(pytest.mark.network, "network", skip_network, "--network"),
(pytest.mark.db, "db", skip_db, "--skip-db"),
]

# Warnings from doctests that can be ignored; place reason in comment above.
# Each entry specifies (path, message) - see the ignore_doctest_warning function
ignored_doctest_warnings = [
Expand All @@ -168,19 +150,6 @@ def pytest_collection_modifyitems(items, config) -> None:
if "/frame/" in item.nodeid:
item.add_marker(pytest.mark.arraymanager)

for mark, kwd, skip_if_found, arg_name in marks:
if kwd in item.keywords:
# If we're skipping, no need to actually add the marker or look for
# other markers
if skip_if_found:
item.add_marker(pytest.mark.skip(f"skipping due to {arg_name}"))
break

item.add_marker(mark)

if only_slow and "slow" not in item.keywords:
item.add_marker(pytest.mark.skip("skipping due to --only-slow"))


# Hypothesis
hypothesis.settings.register_profile(
Expand Down
18 changes: 5 additions & 13 deletions pandas/tests/extension/test_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,23 +375,15 @@ def test_accumulate_series(self, data, all_numeric_accumulations, skipna, reques

if do_skip:
pytest.skip(
"These should *not* work, we test in test_accumulate_series_raises "
"that these correctly raise."
f"{op_name} should *not* work, we test in "
"test_accumulate_series_raises that these correctly raise."
)

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

request.node.add_marker(
pytest.mark.xfail(
reason=f"{all_numeric_accumulations} not implemented",
raises=NotImplementedError,
)
)
elif all_numeric_accumulations == "cumsum" and (pa.types.is_boolean(pa_type)):
request.node.add_marker(
pytest.mark.xfail(
Expand Down
4 changes: 2 additions & 2 deletions pandas/util/_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def test(extra_args: list[str] | None = None) -> None:
"""
Run the pandas test suite using pytest.

By default, runs with the marks --skip-slow, --skip-network, --skip-db
By default, runs with the marks -m "not slow and not network and not db"

Parameters
----------
Expand All @@ -24,7 +24,7 @@ def test(extra_args: list[str] | None = None) -> None:
"""
pytest = import_optional_dependency("pytest")
import_optional_dependency("hypothesis")
cmd = ["--skip-slow", "--skip-network", "--skip-db"]
cmd = ['-m "not slow and not network and not db"']
if extra_args:
if not isinstance(extra_args, list):
extra_args = [extra_args]
Expand Down