Skip to content

Commit

Permalink
CI Make pytest err on PytestUnraisableExceptionWarning (#24438)
Browse files Browse the repository at this point in the history
Co-authored-by: Jérémie du Boisberranger <jeremiedbb@users.noreply.github.com>
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
  • Loading branch information
3 people committed Sep 19, 2022
1 parent 7cc5adc commit 0ae132f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Expand Up @@ -278,6 +278,7 @@ jobs:
LOCK_FILE: ./build_tools/azure/py38_conda_forge_mkl_win-64_conda.lock
CHECK_WARNINGS: 'true'
COVERAGE: 'true'
SKLEARN_ENABLE_DEBUG_CYTHON_DIRECTIVES: '1'
SKLEARN_TESTS_GLOBAL_RANDOM_SEED: '7' # non-default seed
py38_pip_openblas_32bit:
DISTRIB: 'pip-windows'
Expand Down
7 changes: 7 additions & 0 deletions build_tools/azure/test_script.sh
Expand Up @@ -69,6 +69,13 @@ if [[ -n "$CHECK_WARNINGS" ]]; then

# Ignore distutils deprecation warning, used by joblib internally
TEST_CMD="$TEST_CMD -Wignore:distutils\ Version\ classes\ are\ deprecated:DeprecationWarning"

# In some case, exceptions are raised (by bug) in tests, and captured by pytest,
# but not raised again. This is for instance the case when Cython directives are
# activated: IndexErrors (which aren't fatal) are raised on out-of-bound accesses.
# In those cases, pytest instead raises pytest.PytestUnraisableExceptionWarnings,
# which we must treat as errors on the CI.
TEST_CMD="$TEST_CMD -Werror::pytest.PytestUnraisableExceptionWarning"
fi

if [[ "$PYTEST_XDIST_VERSION" != "none" ]]; then
Expand Down

0 comments on commit 0ae132f

Please sign in to comment.