From 7eeab68a9d07aa6b01df9ef5197b2c73a9740f3e Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 09:15:44 -0500 Subject: [PATCH 01/11] CLN: move pytest config to pyproject.toml --- .github/workflows/ci.yml | 2 +- .github/workflows/database.yml | 2 +- ci/run_tests.sh | 4 ++-- doc/source/getting_started/install.rst | 2 +- doc/source/whatsnew/v1.3.0.rst | 2 +- pandas/conftest.py | 18 ------------------ pyproject.toml | 26 ++++++++++++++++++++++++++ setup.cfg | 14 +------------- test_fast.bat | 2 +- test_fast.sh | 2 +- 10 files changed, 35 insertions(+), 39 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6744f578560c..80c912c299119 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: if: always() - name: Testing docstring validation script - run: pytest --capture=no --strict-markers scripts + run: pytest --capture=no scripts if: always() - name: Running benchmarks diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index ba5a0a1fd0909..0014e6354b412 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -78,7 +78,7 @@ jobs: uses: ./.github/actions/build_pandas - name: Test - run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile -s --strict-markers --durations=30 --junitxml=test-data.xml -s --cov=pandas --cov-report=xml pandas/tests/io + run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile -s --durations=30 --junitxml=test-data.xml -s --cov=pandas --cov-report=xml pandas/tests/io if: always() - name: Build Version diff --git a/ci/run_tests.sh b/ci/run_tests.sh index d73940c1010ad..393ec6c388d96 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -19,7 +19,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then XVFB="xvfb-run " fi -PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile -s --strict-markers --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" +PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile -s --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" if [[ $(uname) != "Linux" && $(uname) != "Darwin" ]]; then # GH#37455 windows py38 build appears to be running out of memory @@ -30,7 +30,7 @@ fi echo $PYTEST_CMD sh -c "$PYTEST_CMD" -PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile -s --strict-markers --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" +PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile -s --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" echo $PYTEST_AM_CMD sh -c "$PYTEST_AM_CMD" diff --git a/doc/source/getting_started/install.rst b/doc/source/getting_started/install.rst index a9c3d637a41e3..32e2d9a81baa1 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -193,7 +193,7 @@ pandas is equipped with an exhaustive set of unit tests, covering about 97% of the code base as of this writing. To run it on your machine to verify that everything is working (and that you have all of the dependencies, soft and hard, installed), make sure you have `pytest -`__ >= 5.0.1 and `Hypothesis +`__ >= 6.0 and `Hypothesis `__ >= 3.58, then run: :: diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index 92efb225682b7..d8102dacebc11 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -339,7 +339,7 @@ If installed, we now require: +-----------------+-----------------+----------+---------+ | numexpr | 2.6.8 | | | +-----------------+-----------------+----------+---------+ -| pytest (dev) | 5.0.1 | | | +| pytest (dev) | 6.0. | | X | +-----------------+-----------------+----------+---------+ | mypy (dev) | 0.800 | | X | +-----------------+-----------------+----------+---------+ diff --git a/pandas/conftest.py b/pandas/conftest.py index f3356d2998ff8..caf2e6a0cd58a 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -71,24 +71,6 @@ # Configuration / Settings # ---------------------------------------------------------------- # pytest -def pytest_configure(config): - # Register marks to avoid warnings in pandas.test() - # sync with setup.cfg - config.addinivalue_line("markers", "single: mark a test as single cpu only") - config.addinivalue_line("markers", "slow: mark a test as slow") - config.addinivalue_line("markers", "network: mark a test as network") - config.addinivalue_line( - "markers", "db: tests requiring a database (mysql or postgres)" - ) - config.addinivalue_line("markers", "high_memory: mark a test as a high-memory only") - config.addinivalue_line("markers", "clipboard: mark a pd.read_clipboard test") - config.addinivalue_line( - "markers", "arm_slow: mark a test as slow for arm64 architecture" - ) - config.addinivalue_line( - "markers", "arraymanager: mark a test to run with ArrayManager enabled" - ) - def pytest_addoption(parser): parser.addoption("--skip-slow", action="store_true", help="skip slow tests") diff --git a/pyproject.toml b/pyproject.toml index 9f11475234566..a8ebed8f87da7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,3 +32,29 @@ exclude = ''' | setup.py ) ''' + +[tool.pytest.ini_options] +minversion = "6.0" +addopts = "--strict-data-files --strict-markers" +xfail_strict = true +testpaths = "pandas" +doctest_optionflags = [ + "NORMALIZE_WHITESPACE", + "IGNORE_EXCEPTION_DETAIL", + "ELLIPSIS", +] +filterwarnings = [ + "error:Sparse:FutureWarning", + "error:The SparseArray:FutureWarning", +] +junit_family = "xunit2" +markers = [ + "single: mark a test as single cpu only", + "slow: mark a test as slow", + "network: mark a test as network", + "db: tests requiring a database (mysql or postgres)", + "high_memory: mark a test as a high-memory only", + "clipboard: mark a pd.read_clipboard test", + "arm_slow: mark a test as slow for arm64 architecture", + "arraymanager: mark a test to run with ArrayManager enabled", +] diff --git a/setup.cfg b/setup.cfg index a0b6a0cdfc260..690e3bd601754 100644 --- a/setup.cfg +++ b/setup.cfg @@ -45,7 +45,7 @@ pandas_plotting_backends = [options.extras_require] test = hypothesis>=3.58 - pytest>=5.0.1 + pytest>=6.0 pytest-xdist [options.package_data] @@ -108,18 +108,6 @@ exclude = # https://github.com/pandas-dev/pandas/pull/38837#issuecomment-752884156 doc/source/getting_started/comparison/includes/*.rst -[tool:pytest] -# sync minversion with setup.cfg & install.rst -minversion = 5.0.1 -testpaths = pandas -doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL ELLIPSIS -addopts = --strict-data-files -xfail_strict = True -filterwarnings = - error:Sparse:FutureWarning - error:The SparseArray:FutureWarning -junit_family = xunit2 - [codespell] ignore-words-list = ba,blocs,coo,hist,nd,sav,ser ignore-regex = https://(\w+\.)+ diff --git a/test_fast.bat b/test_fast.bat index 34c61fea08ab4..642e0549f3228 100644 --- a/test_fast.bat +++ b/test_fast.bat @@ -1,3 +1,3 @@ :: test on windows set PYTHONHASHSEED=314159265 -pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX --strict-markers pandas +pytest --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sXX pandas diff --git a/test_fast.sh b/test_fast.sh index 6444b81b3c6da..9d446964cf501 100755 --- a/test_fast.sh +++ b/test_fast.sh @@ -5,4 +5,4 @@ # https://github.com/pytest-dev/pytest/issues/1075 export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))') -pytest pandas --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sxX --strict-markers "$@" +pytest pandas --skip-slow --skip-network --skip-db -m "not single" -n 4 -r sxX "$@" From 1d81b7dfd70300a5c99093e3c012872e6d79ecf4 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 09:24:57 -0500 Subject: [PATCH 02/11] fix typo --- doc/source/whatsnew/v1.3.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v1.3.0.rst b/doc/source/whatsnew/v1.3.0.rst index d8102dacebc11..93c5e115e5a59 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -339,7 +339,7 @@ If installed, we now require: +-----------------+-----------------+----------+---------+ | numexpr | 2.6.8 | | | +-----------------+-----------------+----------+---------+ -| pytest (dev) | 6.0. | | X | +| pytest (dev) | 6.0 | | X | +-----------------+-----------------+----------+---------+ | mypy (dev) | 0.800 | | X | +-----------------+-----------------+----------+---------+ From 226a00960cbe2a26c52222939176f0be56898c3c Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 09:33:56 -0500 Subject: [PATCH 03/11] fix space --- pandas/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pandas/conftest.py b/pandas/conftest.py index caf2e6a0cd58a..1d7fd0070e394 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -72,6 +72,7 @@ # ---------------------------------------------------------------- # pytest + def pytest_addoption(parser): parser.addoption("--skip-slow", action="store_true", help="skip slow tests") parser.addoption("--skip-network", action="store_true", help="skip network tests") From a9679a4f58fc70e9bcd10d1ffc313794729b3fc1 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 09:56:56 -0500 Subject: [PATCH 04/11] fix space --- pandas/conftest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/conftest.py b/pandas/conftest.py index 1d7fd0070e394..a07986682d30c 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -66,7 +66,6 @@ MultiIndex, ) - # ---------------------------------------------------------------- # Configuration / Settings # ---------------------------------------------------------------- From 310e57a89c6aab62cb03a90eb1e64264bd785a92 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 11:43:25 -0500 Subject: [PATCH 05/11] move more opts to config file --- .github/workflows/ci.yml | 2 +- ci/run_tests.sh | 4 ++-- pyproject.toml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80c912c299119..ca0c75f9de94f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,7 @@ jobs: if: always() - name: Testing docstring validation script - run: pytest --capture=no scripts + run: pytest scripts if: always() - name: Running benchmarks diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 393ec6c388d96..d7e0274ea678e 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -19,7 +19,7 @@ if [[ $(uname) == "Linux" && -z $DISPLAY ]]; then XVFB="xvfb-run " fi -PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile -s --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" +PYTEST_CMD="${XVFB}pytest -m \"$PATTERN\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas" if [[ $(uname) != "Linux" && $(uname) != "Darwin" ]]; then # GH#37455 windows py38 build appears to be running out of memory @@ -30,7 +30,7 @@ fi echo $PYTEST_CMD sh -c "$PYTEST_CMD" -PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile -s --durations=30 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas" +PYTEST_AM_CMD="PANDAS_DATA_MANAGER=array pytest -m \"$PATTERN and arraymanager\" -n $PYTEST_WORKERS --dist=loadfile $TEST_ARGS $COVERAGE pandas" echo $PYTEST_AM_CMD sh -c "$PYTEST_AM_CMD" diff --git a/pyproject.toml b/pyproject.toml index a8ebed8f87da7..6214c87da96f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,7 +35,7 @@ exclude = ''' [tool.pytest.ini_options] minversion = "6.0" -addopts = "--strict-data-files --strict-markers" +addopts = "--strict-data-files --strict-markers --capture=no --durations=30 --junitxml=test-data.xml" xfail_strict = true testpaths = "pandas" doctest_optionflags = [ From af3be8dcb5124c226434bee4a0b7a2e611fd2980 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 11:46:09 -0500 Subject: [PATCH 06/11] move more opts to config file --- .github/workflows/database.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index 0014e6354b412..a5aef7825c770 100644 --- a/.github/workflows/database.yml +++ b/.github/workflows/database.yml @@ -78,7 +78,7 @@ jobs: uses: ./.github/actions/build_pandas - name: Test - run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile -s --durations=30 --junitxml=test-data.xml -s --cov=pandas --cov-report=xml pandas/tests/io + run: pytest -m "${{ env.PATTERN }}" -n 2 --dist=loadfile --cov=pandas --cov-report=xml pandas/tests/io if: always() - name: Build Version From 96e8d20532d32bd234b12ee82efb99bc721080fa Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Sat, 27 Mar 2021 13:02:42 -0500 Subject: [PATCH 07/11] change min version --- ci/deps/actions-37-minimum_versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deps/actions-37-minimum_versions.yaml b/ci/deps/actions-37-minimum_versions.yaml index e14e51a36be31..15186415c3f45 100644 --- a/ci/deps/actions-37-minimum_versions.yaml +++ b/ci/deps/actions-37-minimum_versions.yaml @@ -6,7 +6,7 @@ dependencies: # tools - cython=0.29.21 - - pytest=5.0.1 + - pytest=6.0 - pytest-cov - pytest-xdist>=1.21 - hypothesis>=3.58.0 From e39a0cef32ff83f2abcde50da569ff2ed3d7bdec Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Wed, 31 Mar 2021 15:14:38 -0500 Subject: [PATCH 08/11] add comment back --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 6214c87da96f3..15b96bc51dbca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,6 +34,7 @@ exclude = ''' ''' [tool.pytest.ini_options] +# sync minversion with pyproject.toml & install.rst minversion = "6.0" addopts = "--strict-data-files --strict-markers --capture=no --durations=30 --junitxml=test-data.xml" xfail_strict = true From db34d63718bc667fb3b051baa47cea213d200b67 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Mon, 19 Apr 2021 15:43:38 -0500 Subject: [PATCH 09/11] resolve conflict --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 01d28777eb47e..cfb5556cb4531 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,6 +47,7 @@ doctest_optionflags = [ filterwarnings = [ "error:Sparse:FutureWarning", "error:The SparseArray:FutureWarning", + "ignore:unclosed transport Date: Wed, 21 Apr 2021 14:37:10 -0500 Subject: [PATCH 10/11] unpin pytest version --- ci/deps/actions-37-minimum_versions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/deps/actions-37-minimum_versions.yaml b/ci/deps/actions-37-minimum_versions.yaml index b759baee31a0b..3237cf9770220 100644 --- a/ci/deps/actions-37-minimum_versions.yaml +++ b/ci/deps/actions-37-minimum_versions.yaml @@ -6,7 +6,7 @@ dependencies: # tools - cython=0.29.21 - - pytest=6.0 + - pytest>=6.0 - pytest-cov - pytest-xdist>=1.21 - hypothesis>=3.58.0 From 80ba6338dee5fea32a934c379a39da634e286b43 Mon Sep 17 00:00:00 2001 From: Fangchen Li Date: Thu, 22 Apr 2021 21:09:28 -0500 Subject: [PATCH 11/11] resolve conflict --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index cfb5556cb4531..01d28777eb47e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,6 @@ doctest_optionflags = [ filterwarnings = [ "error:Sparse:FutureWarning", "error:The SparseArray:FutureWarning", - "ignore:unclosed transport