Skip to content

Commit 0576236

Browse files
simonjayhawkinsPingviinituutti
authored andcommitted
CI/TST: Check that unittest.mock is not being used in testing (pandas-dev#24648)
1 parent 2e59512 commit 0576236

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ci/code_checks.sh

+5
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,11 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
148148
invgrep -R --exclude=*.pyc --exclude=testing.py --exclude=test_util.py assert_raises_regex pandas
149149
RET=$(($RET + $?)) ; echo $MSG "DONE"
150150

151+
# Check for the following code in testing: `unittest.mock`, `mock.Mock()` or `mock.patch`
152+
MSG='Check that unittest.mock is not used (pytest builtin monkeypatch fixture should be used instread)' ; echo $MSG
153+
invgrep -r -E --include '*.py' '(unittest(\.| import )mock|mock\.Mock\(\)|mock\.patch)' pandas/tests/
154+
RET=$(($RET + $?)) ; echo $MSG "DONE"
155+
151156
# Check that we use pytest.raises only as a context manager
152157
#
153158
# For any flake8-compliant code, the only way this regex gets

0 commit comments

Comments
 (0)