diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6744f578560c..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 --strict-markers scripts + run: pytest scripts if: always() - name: Running benchmarks diff --git a/.github/workflows/database.yml b/.github/workflows/database.yml index ba5a0a1fd0909..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 --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 --cov=pandas --cov-report=xml pandas/tests/io if: always() - name: Build Version diff --git a/ci/deps/actions-37-minimum_versions.yaml b/ci/deps/actions-37-minimum_versions.yaml index 8052156858a32..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=5.0.1 + - pytest>=6.0 - pytest-cov - pytest-xdist>=1.21 - hypothesis>=3.58.0 diff --git a/ci/run_tests.sh b/ci/run_tests.sh index f5e3420b8c9b3..261d6364cb5e1 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 $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 $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 89b21d1984ad3..16beb00d201b7 100644 --- a/doc/source/getting_started/install.rst +++ b/doc/source/getting_started/install.rst @@ -195,7 +195,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 842b50ce53b21..31517e363140d 100644 --- a/doc/source/whatsnew/v1.3.0.rst +++ b/doc/source/whatsnew/v1.3.0.rst @@ -515,7 +515,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 35affa62ccf68..7b29c41ef70f5 100644 --- a/pandas/conftest.py +++ b/pandas/conftest.py @@ -66,28 +66,10 @@ MultiIndex, ) - # ---------------------------------------------------------------- # 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): diff --git a/pyproject.toml b/pyproject.toml index 3ffda4e2149c0..01d28777eb47e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,3 +32,30 @@ exclude = ''' | setup.py ) ''' + +[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 +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 610b30e4422a9..f39e377e50c97 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] @@ -127,18 +127,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 "$@"