diff --git a/ci/code_checks.sh b/ci/code_checks.sh index ac92cf492b91d..028a9c71a0d2d 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -148,6 +148,15 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then invgrep -R --exclude=*.pyc --exclude=testing.py --exclude=test_testing.py assert_raises_regex pandas RET=$(($RET + $?)) ; echo $MSG "DONE" + # Check that we use pytest.raises only as a context manager + # + # For any flake8-compliant code, the only way this regex gets + # matched is if there is no "with" statement preceding "pytest.raises" + MSG='Check for pytest.raises as context manager (a line starting with `pytest.raises` is invalid, needs a `with` to precede it)' ; echo $MSG + MSG='TODO: This check is currently skipped because so many files fail this. Please enable when all are corrected (xref gh-24332)' ; echo $MSG + # invgrep -R --include '*.py' -E '[[:space:]] pytest.raises' pandas/tests + # RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Check that no file in the repo contains tailing whitespaces' ; echo $MSG invgrep --exclude="*.svg" -RI "\s$" * RET=$(($RET + $?)) ; echo $MSG "DONE"