fix: clear the remaining test-suite warnings (#872) - #1079
Open
ilayfalach wants to merge 1 commit into
Open
ilayfalach wants to merge 1 commit into
ilayfalach wants to merge 1 commit into
Conversation
PR #878 handled part of this; a full run against Mongo (1423 tests, notebooks deselected) still reported 7 warnings. Four had a real source, now fixed: - `evtk` is a deprecation shim whose entire body is `from pyevtk import *` plus a DeprecationWarning — `evtk.hl is pyevtk.hl` is True, so importing pyevtk directly is the same module with no behaviour change. hera/simulations/openFoam/toolkit.py and hera/simulations/openFoam/lagrangian/LSM/toolkit.py now do so. - The `_mongo_is_available()` probes in hera/tests/test_datalayer.py and hera/tests/test_experiment.py built a MongoClient at collection time and never closed it (ResourceWarning: Unclosed MongoClient). Both now use the client as a context manager. - hera/tests/unit/test_openfoam_dataset2of.py read a source file with a bare `open(...).read()`; now `pathlib.Path(...).read_text()`. The run is down to 7 warnings -> 2, and neither of the two is a defect: the freecad UserWarning is the module's own "not installed" notice, and the open `Errors.log` handle belongs to hera's logging FileHandler, which is meant to stay open for the life of the process. The FutureWarning on hera/measurements/GIS/raster/topography.py that the issue asks to start with no longer reproduces — `elevation` is assigned as 0.0 in all three branches of getPointListElevation, so the column is already float. Not changed, reported separately: `structuredToVTK` does not exist in pyevtk/evtk.hl at all, so hera/simulations/openFoam/toolkit.py:1244 and lagrangian/LSM/toolkit.py:825 call a name that cannot resolve. In the LSM file a `try/except ImportError` turns that into a silent `None`, so the call site fails with a TypeError instead. That is a pre-existing runtime bug, not a deprecation, and picking its replacement needs a decision this ticket should not make. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #872.
The problem
The issue says ~70 deprecated uses. A full run against MongoDB today (1423 tests, notebooks deselected) reported 7 warnings — PR #878 and later work had already cleared most. Four of the seven had a real source.
What changed
evtkis a deprecation shim whose entire body isfrom pyevtk import *plus aDeprecationWarning.evtk.hl is pyevtk.hlisTrue, so importing pyevtk directly is the same module object — no behaviour change. Changed inopenFoam/toolkit.pyandopenFoam/lagrangian/LSM/toolkit.py._mongo_is_available()probes intest_datalayer.pyandtest_experiment.pybuilt aMongoClientat collection time and never closed it. Both now use it as a context manager.test_openfoam_dataset2of.pyread a file with a bareopen(...).read(); nowpathlib.Path(...).read_text().Result: 7 warnings → 2. Neither remaining one is a defect — the freecad
UserWarningis that module's own "not installed" notice, and the openErrors.loghandle belongs to hera's loggingFileHandler, which is meant to stay open.The
topography.pyFutureWarningthe issue asks to start with no longer reproduces:elevationis assigned as0.0in all three branches ofgetPointListElevation, so the column is already float.Two things found, deliberately not changed here
structuredToVTKdoes not exist in pyevtk at all, yetopenFoam/toolkit.py:1244andlagrangian/LSM/toolkit.py:825call it. In the LSM file atry/except ImportErrorturns that into a silentNone, so the call fails withTypeError. Pre-existing runtime bug; picking the replacement (gridToVTK?) is a decision, not a deprecation fix.ci.ymlpinsmongo:latest, which refuses to start on Linux kernel 6.19+ (SERVER-121912). GitHub runners are below that so CI is fine today, but it already blocks local dev.mongo:7works.🤖 Generated with Claude Code