Skip to content

[test] Use Python development module with warnings as errors for testing#21157

Open
guitargeek wants to merge 2 commits intoroot-project:masterfrom
guitargeek:python_dev
Open

[test] Use Python development module with warnings as errors for testing#21157
guitargeek wants to merge 2 commits intoroot-project:masterfrom
guitargeek:python_dev

Conversation

@guitargeek
Copy link
Copy Markdown
Contributor

From the docs [1]:

The Python Development Mode introduces additional runtime checks that
are too expensive to be enabled by default. It should not be more
verbose than the default if the code is correct; new warnings are only
emitted when an issue is detected.

Also use the -W error flag to treat warnings as errors.

This should help us to find bugs and problems with the tests.

[1] https://docs.python.org/3/library/devmode.html

@guitargeek guitargeek self-assigned this Feb 4, 2026
@guitargeek guitargeek requested a review from bellenot as a code owner February 4, 2026 13:04
@guitargeek guitargeek force-pushed the python_dev branch 2 times, most recently from eb13c60 to 88c07d3 Compare February 4, 2026 13:24
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 4, 2026

Test Results

    22 files      22 suites   3d 1h 43m 59s ⏱️
 3 833 tests  3 771 ✅  1 💤  61 ❌
75 653 runs  75 269 ✅ 18 💤 366 ❌

For more details on these failures, see this check.

Results for commit 0701b48.

♻️ This comment has been updated with latest results.

From the docs [1]:

> The Python Development Mode introduces additional runtime checks that
  are too expensive to be enabled by default. It should not be more
  verbose than the default if the code is correct; new warnings are only
  emitted when an issue is detected.

Also use the `-W error` flag to treat warnings as errors.

This should help us to find bugs and problems with the tests.

[1] https://docs.python.org/3/library/devmode.html
  * Skip training for models without trainable weights to avoid spurious
    Keras warnings about "no trainable weights"

  * Suppress NumPy 2.0 __array__ DeprecationWarning during model.save()
    (upstream TF/Keras compatibility issue) using a scoped warnings context

  * Fix Keras inference call for single-input models by unwrapping
    singleton input lists (Keras expects a tensor, not [tensor])

  * Remove redundant load_weights() after load_model()

  * Replace custom is_accurate() with np.testing.assert_allclose()
    for clearer diagnostics and standardized comparison
    * use atol=1e-2 and rtol=0 to preserve previous absolute tolerance behavior

  * Update LeakyReLU argument (alpha -> negative_slope) to avoid
    deprecation warnings

These changes make the tests more robust, reduce noise from external
dependencies, and significantly improve failure diagnostics.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant