Skip to content

Commit f88ebd2

Browse files
committed
STY: Check pytest.raises is used context manager
Follow-up to pandas-devgh-24297.
1 parent 216986d commit f88ebd2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ci/code_checks.sh

+8
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
151151
MSG='Check that no file in the repo contains tailing whitespaces' ; echo $MSG
152152
invgrep --exclude="*.svg" -RI "\s$" *
153153
RET=$(($RET + $?)) ; echo $MSG "DONE"
154+
155+
# Check that we use pytest.raises only as a context manager
156+
#
157+
# For any flake8-compliant code, the only way this regex gets
158+
# matched is if there is no "with" statement preceding "pytest.raises"
159+
MSG='Check for pytest.raises as context manager' ; echo $MSG
160+
invgrep -R --include '*.py' -E '[[:space:]] pytest.raises' pandas/tests
161+
RET=$(($RET + $?)) ; echo $MSG "DONE"
154162
fi
155163

156164
### CODE ###

0 commit comments

Comments
 (0)