From d7df0a253ff650e0b7b112fc6aca2c69ec9523ec Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 19 Feb 2023 12:23:24 -0800 Subject: [PATCH 1/5] TST/CLN: Remove --skip-* flags in favor of -m --- .github/workflows/wheels.yml | 4 ++-- ci/test_wheels.py | 19 +++++----------- ci/test_wheels_windows.bat | 4 ++-- doc/source/getting_started/install.rst | 2 +- pandas/conftest.py | 31 -------------------------- pandas/util/_tester.py | 4 ++-- 6 files changed, 13 insertions(+), 51 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 665aeb6bc7f87..6ded5de898dae 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -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 diff --git a/ci/test_wheels.py b/ci/test_wheels.py index c9258422baefd..0acb048a121a7 100644 --- a/ci/test_wheels.py +++ b/ci/test_wheels.py @@ -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"', ] ) diff --git a/ci/test_wheels_windows.bat b/ci/test_wheels_windows.bat index ae7869d63b1ff..010b759766aa1 100644 --- a/ci/test_wheels_windows.bat +++ b/ci/test_wheels_windows.bat @@ -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 diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index c1295df53fc2b..28a57720a89a5 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -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 diff --git a/pandas/conftest.py b/pandas/conftest.py index 773da503ddb2b..ea69db60fd2ba 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -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", @@ -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 = [ @@ -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( diff --git a/pandas/util/_tester.py b/pandas/util/_tester.py index 3fe7c4d589993..80e0d13ed5a69 100644 --- a/pandas/util/_tester.py +++ b/pandas/util/_tester.py @@ -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 ---------- @@ -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] From 6627738ebfc1c9eea9f4b2f03dbaab9315d39ba6 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 19 Feb 2023 12:24:39 -0800 Subject: [PATCH 2/5] Fix documentation --- pandas/util/_tester.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/util/_tester.py b/pandas/util/_tester.py index 80e0d13ed5a69..1732b75a2a2b9 100644 --- a/pandas/util/_tester.py +++ b/pandas/util/_tester.py @@ -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 "-m not slow and not network and not db" + By default, runs with the marks -m "not slow and not network and not db" Parameters ---------- From 07a4a877827189d1fd998dfb9ec940648f4a06e6 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 19 Feb 2023 12:27:09 -0800 Subject: [PATCH 3/5] trigger ci From bc5aa0a418df5e3a1937474fae4d5ca451d4af1a Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 19 Feb 2023 18:38:21 -0800 Subject: [PATCH 4/5] Fix test --- pandas/tests/extension/test_arrow.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/pandas/tests/extension/test_arrow.py b/pandas/tests/extension/test_arrow.py index 75ad125c3b674..bdefc65e1f957 100644 --- a/pandas/tests/extension/test_arrow.py +++ b/pandas/tests/extension/test_arrow.py @@ -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( From 23321fe249650628efbee6bc6164020d67207b24 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Sun, 19 Feb 2023 19:16:04 -0800 Subject: [PATCH 5/5] Undo quotes --- .github/workflows/wheels.yml | 4 ++-- ci/test_wheels.py | 4 ++-- ci/test_wheels_windows.bat | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 6ded5de898dae..31ed5096991a6 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -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 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"'])" + 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 diff --git a/ci/test_wheels.py b/ci/test_wheels.py index 0acb048a121a7..f861c1cbedcad 100644 --- a/ci/test_wheels.py +++ b/ci/test_wheels.py @@ -39,12 +39,12 @@ import pandas as pd multi_args = [ - '-m "not clipboard and not single_cpu and not slow and not network and not db"', + "-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 single_cpu and not slow and not network and not db"', + "-m not clipboard and single_cpu and not slow and not network and not db", ] ) diff --git a/ci/test_wheels_windows.bat b/ci/test_wheels_windows.bat index 010b759766aa1..33de4fc5ad62d 100644 --- a/ci/test_wheels_windows.bat +++ b/ci/test_wheels_windows.bat @@ -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 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"']) +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