8000 STY: Check pytest.raises is used context manager by gfyoung · Pull Request #24332 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

STY: Check pytest.raises is used context manager #24332

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
Changes from 1 commit
Commits
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
Prev Previous commit
Comment about check and address comments
  • Loading branch information
gfyoung committed Dec 19, 2018
commit 33a427a295e9da6977d33e89e5449fbbb3a288be
13 changes: 7 additions & 6 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,17 @@ 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"

MSG='Check that no file in the repo contains tailing whitespaces' ; echo $MSG
invgrep --exclude="*.svg" -RI "\s$" *
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' ; echo $MSG
invgrep -R --include '*.py' -E '[[:space:]] pytest.raises' pandas/tests
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"
fi

Expand Down
0