Repository navigation
v.report: Close null device and command pipes - #8289
Rohan-Dedhia wants to merge 2 commits into
Conversation
6c1c648 to
c56d270
Compare
|
The windows-2022 failure is an external infra flake, not a code regression. Both runs hit HTTP 502 from download.osgeo.org/osgeo4w/v2/x86_64/setup.ini during the OSGeo4W setup step (around 9 minutes in, after all download retries exhausted). This is unrelated to the v.report changes. All other checks pass: Python Code Quality, build-cmake, gnu17/c++17, ubuntu (24.04), ubuntu temporal, pytest 3.11 on both ubuntu variants, CodeQL, Bandit, Super Linter, codecov, and validate-titles. Could you re-run the windows-2022 job when you get a chance? Happy to address any code feedback in the meantime. Thanks! |
|
No I won’t rerun right away. The download server flakes on and off since yesterday. Even docker images with geos source code fail to download. I already wrote to the SAC and they tried patching the whole server, but it’s not enough still |
|
Understood, thanks for the context! I'll wait for the server situation to resolve. No rush. |
c56d270 to
504a908
Compare
504a908 to
ef82ff1
Compare
|
The code changes look fine. I don’t see the type of tests like you added here very often. It seems really like it is testing the implementation specifically (by importing the Python code itself, depending on internal details), and a bit less on what the tool does. What would happen if we refactor just a bit the file, doing the same thing+same output? The tests will probably fail. There’s some testing guidelines in the repo to help you |
Description
nuldev = open(os.devnull, "w")inscripts/v.report/v.report.pywithsubprocess.DEVNULLpassed togs.vector_columns(..., stderr=subprocess.DEVNULL), avoiding an unclosed Python file object (including whengs.find_fileexits early viags.fatal).gs.pipe_command(...)calls (v.db.select, bothv.to.dbcalls, andv.category) inwithblocks so their stdout pipes and subprocesses are closed and waited on reliably, including on early exit (gs.fatalwhen the key column is missing)."scripts/v.report/v.report.py" = ["PLW1514"]ignore frompyproject.toml.scripts/v.report/tests/v_report_test.pycovering table mode, no-table mode, fatal early exit duringv.db.selectiteration, non-zero returncode exit, and realsubprocess.Popencleanup underResourceWarningtracking.Motivation and context
Fixes the
v.reportfile and pipe leaks tracked in #8122 (Refs #8122).How has this been tested?
Ran locally on Windows (Python 3.13.7, without compiled GRASS binaries):
python -X dev -W error::ResourceWarning -m pytest scripts/v.report/tests/v_report_test.py -v: 5 passed in 0.46s (using mockedgrass.scriptcalls and realsubprocess.Popenpipes for resource-warning checks).ruff check scripts/v.report pyproject.toml: All checks passed.ruff check --preview --select SIM115,PLW1514 --isolated scripts/v.report: All checks passed.ruff format --check scripts/v.report: 3 files already formatted.Full end-to-end execution against compiled GRASS vector modules (
v.db.select,v.to.db,v.category) was not run locally and relies on CI.Types of changes
functionality to not work as before)
Checklist
pre-defined prefixes
of this project.