diff --git a/.github/workflows/macos-windows.yml b/.github/workflows/macos-windows.yml index 5efc1aa67b4cd..d762e20db196a 100644 --- a/.github/workflows/macos-windows.yml +++ b/.github/workflows/macos-windows.yml @@ -16,7 +16,7 @@ env: PANDAS_CI: 1 PYTEST_TARGET: pandas PATTERN: "not slow and not db and not network and not single_cpu" - TEST_ARGS: "-W error:::pandas" + ERROR_ON_WARNINGS: "1" permissions: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 7dbf74278d433..9c93725ea15ec 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -38,7 +38,7 @@ jobs: - name: "Minimum Versions" env_file: actions-38-minimum_versions.yaml pattern: "not slow and not network and not single_cpu" - test_args: "" + error_on_warnings: "0" - name: "Locale: it_IT" env_file: actions-38.yaml pattern: "not slow and not network and not single_cpu" @@ -63,20 +63,22 @@ jobs: env_file: actions-310.yaml pattern: "not slow and not network and not single_cpu" pandas_copy_on_write: "1" - test_args: "" + error_on_warnings: "0" - name: "Data Manager" env_file: actions-38.yaml pattern: "not slow and not network and not single_cpu" pandas_data_manager: "array" - test_args: "" + error_on_warnings: "0" - name: "Pypy" env_file: actions-pypy-38.yaml pattern: "not slow and not network and not single_cpu" test_args: "--max-worker-restart 0" + error_on_warnings: "0" - name: "Numpy Dev" env_file: actions-310-numpydev.yaml pattern: "not slow and not network and not single_cpu" test_args: "-W error::DeprecationWarning:numpy -W error::FutureWarning:numpy" + error_on_warnings: "0" exclude: - env_file: actions-38.yaml pyarrow_version: "7" @@ -96,11 +98,12 @@ jobs: ENV_FILE: ci/deps/${{ matrix.env_file }} PATTERN: ${{ matrix.pattern }} EXTRA_APT: ${{ matrix.extra_apt || '' }} + ERROR_ON_WARNINGS: ${{ matrix.error_on_warnings || '1' }} LANG: ${{ matrix.lang || '' }} LC_ALL: ${{ matrix.lc_all || '' }} PANDAS_DATA_MANAGER: ${{ matrix.pandas_data_manager || 'block' }} PANDAS_COPY_ON_WRITE: ${{ matrix.pandas_copy_on_write || '0' }} - TEST_ARGS: ${{ matrix.test_args || '-W error:::pandas' }} + TEST_ARGS: ${{ matrix.test_args || '' }} PYTEST_WORKERS: ${{ contains(matrix.pattern, 'not single_cpu') && 'auto' || '1' }} PYTEST_TARGET: ${{ matrix.pytest_target || 'pandas' }} IS_PYPY: ${{ contains(matrix.env_file, 'pypy') }} diff --git a/ci/run_tests.sh b/ci/run_tests.sh index e6de5caf955fc..a48d6c1ad6580 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -30,6 +30,13 @@ if [[ "$PATTERN" ]]; then PYTEST_CMD="$PYTEST_CMD -m \"$PATTERN\"" fi +if [[ "$ERROR_ON_WARNINGS" == "1" ]]; then + for pth in $(find pandas -name '*.py' -not -path "pandas/tests/*" | sed -e 's/\.py//g' -e 's/\/__init__//g' -e 's/\//./g'); + do + PYTEST_CMD="$PYTEST_CMD -W error:::$pth" + done +fi + echo $PYTEST_CMD sh -c "$PYTEST_CMD" diff --git a/pandas/tests/arithmetic/test_timedelta64.py b/pandas/tests/arithmetic/test_timedelta64.py index c9bfb5e29460e..72b32246bf8b5 100644 --- a/pandas/tests/arithmetic/test_timedelta64.py +++ b/pandas/tests/arithmetic/test_timedelta64.py @@ -1756,12 +1756,18 @@ def test_td64arr_floordiv_td64arr_with_nat( # columns without missing values expected[[0, 1]] = expected[[0, 1]].astype("int64") - result = left // right + with tm.maybe_produces_warning( + RuntimeWarning, box is pd.array, check_stacklevel=False + ): + result = left // right tm.assert_equal(result, expected) # case that goes through __rfloordiv__ with arraylike - result = np.asarray(left) // right + with tm.maybe_produces_warning( + RuntimeWarning, box is pd.array, check_stacklevel=False + ): + result = np.asarray(left) // right tm.assert_equal(result, expected) @pytest.mark.filterwarnings("ignore:invalid value encountered:RuntimeWarning")