Skip to content

CI: Test pandas warnings as error on some builds #50386

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 23 commits into from
Dec 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
0d48c9c
disable some workflows
mroeschke Dec 21, 2022
cf9fc6a
test internal warning raises
mroeschke Dec 21, 2022
93cb82a
Add $
mroeschke Dec 21, 2022
3b83f9e
Revert "disable some workflows"
mroeschke Dec 21, 2022
7659116
Revert "test internal warning raises"
mroeschke Dec 21, 2022
7c439dd
Add $
mroeschke Dec 21, 2022
98db2f8
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 22, 2022
280c8d7
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 22, 2022
0d0460b
try alternative method
mroeschke Dec 23, 2022
7e925cb
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 23, 2022
d224261
Fix typos
mroeschke Dec 23, 2022
bf9e79b
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 27, 2022
e38a9c6
test new check
mroeschke Dec 27, 2022
fcf22a0
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 27, 2022
fe1f3fb
Modules not paths
mroeschke Dec 27, 2022
0153514
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 28, 2022
d50fe73
It works
mroeschke Dec 28, 2022
c2d9de0
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 28, 2022
0127a63
Catch new warnings
mroeschke Dec 28, 2022
64afb0a
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 28, 2022
d57d7c2
Use 0/1
mroeschke Dec 28, 2022
0496ffd
Merge remote-tracking branch 'upstream/main' into ci/warnings_test
mroeschke Dec 29, 2022
51e9688
Fix workflow
mroeschke Dec 29, 2022
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
2 changes: 1 addition & 1 deletion .github/workflows/macos-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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') }}
Expand Down
7 changes: 7 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
10 changes: 8 additions & 2 deletions pandas/tests/arithmetic/test_timedelta64.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down