Runner refactoring 2/5: Characterization tests for runner/utils.py, run_solver.py, run_benchmarks.py - #578
Draft
eantonini wants to merge 4 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
This PR locks in current behavior of the runner scripts before the actual refactor splits them into a module package.
runner/tests/(conftest.py + test_utils.py + test_run_solver.py + test_run_benchmarks.py), 106 tests covering:calculate_sgm,is_solved,compute_summary_results,allocate_vms_greedy,allocate_benchmarks,load_benchmark_metadata;HighsVariant,is_mip_problem,get_duality_gap,get_reported_runtime,calculate_integrality_violation,get_solver's seed-options wiring;csv_record,write_csv_headers/write_csv_rowround-trip,parse_memory,get_conda_package_versions,download_benchmark_file,benchmark_solver's timeout/OOM/error branches.utils.py(csv_record,parse_memory,get_conda_package_versions,download_benchmark_file,benchmark_solver) actually live inrun_benchmarks.pytoday — tested there instead, matching the real current layout.pixi run -e runner pytest runner/tests -vinto CI, right after metadata-schema validation.runnerpixi feature withmatplotlib,numpy,ipython,linopy— needed to importutils.py/run_solver.py/run_benchmarks.pyat all (they pull these in at module level even for non-plotting/non-solving functions). None of this is needed by the CLI in production; it's exactly the coupling Refactor PR 3's module split removes, so expect this to shrink back out then.Notable finding
Characterization testing surfaced a real pre-existing bug:
benchmark_solvercrashes with an uncaughtIndexError(notValueError) if the wrapped subprocess produces completely empty stderr, sinceparse_memorydoesoutput.splitlines()[-1]with no guard for empty input. Documented as a test locking in current behavior rather than fixed here — out of scope for a characterization-only PR.Test plan
pixi run -e runner pytest runner/tests -v— 106 passedruff check/ruff format --checkclean on new test files