Opened 5 years ago
Closed 5 years ago
#20832 closed enhancement (fixed)
Add a doctest for GLPK error handling and verbose output
Reported by:  jdemeyer  Owned by:  

Priority:  major  Milestone:  sage7.3 
Component:  doctest coverage  Keywords:  
Cc:  fbissey  Merged in:  
Authors:  Jeroen Demeyer  Reviewers:  Matthias Koeppe 
Report Upstream:  N/A  Work issues:  
Branch:  75e8fe2 (Commits, GitHub, GitLab)  Commit:  75e8fe2131b6751e25917bb9c195ff55c310dc0c 
Dependencies:  Stopgaps: 
Description
The interaction between GLPK error handling and verbose output should be doctested. This would break without the custom have_error.patch
for GLPK in Sage.
Change History (10)
comment:1 Changed 5 years ago by
 Branch set to u/jdemeyer/add_a_doctest_for_glpk_error_handling_and_verbose_output
comment:2 Changed 5 years ago by
 Commit set to 49bab5b43179cf847d2b18adcb398a50b058bbf6
 Status changed from new to needs_review
comment:3 followup: ↓ 4 Changed 5 years ago by
 Reviewers set to Matthias Koeppe
 Status changed from needs_review to positive_review
Positive review, though I personally would think it would be better to test whether there is *some* output rather than test for specific output, which might change whenever a new version of GLPK is installed.
comment:4 in reply to: ↑ 3 Changed 5 years ago by
Replying to mkoeppe:
it would be better to test whether there is *some* output
How would you write the doctest then? The ellipsis ...
matches the empty string, so you need to write at least some part of the verbose output in the doctest.
comment:5 Changed 5 years ago by
How about
0: obj ...
comment:6 Changed 5 years ago by
 Status changed from positive_review to needs_work
sage t long src/sage/libs/glpk/error.pyx ********************************************************************** File "src/sage/libs/glpk/error.pyx", line 98, in sage.libs.glpk.error.setup_glpk_error_handler Failed example: p.solve() Expected: 0: obj = 3.000000000e+00 infeas = 3.000e+00 (0) * 1: obj = 2.000000000e+00 infeas = 0.000e+00 (0) * 2: obj = 2.400000000e+00 infeas = 0.000e+00 (0) + 2: mip = not found yet <= +inf (1; 0) + 2: >>>>> 2.400000000e+00 <= 2.400000000e+00 0.0% (1; 0) + 2: mip = 2.400000000e+00 <= tree is empty 0.0% (0; 1) 2.4 Got: 0: obj = 3.000000000e+00 infeas = 3.000e+00 (0) * 1: obj = 2.000000000e+00 infeas = 0.000e+00 (0) * 2: obj = 2.400000000e+00 infeas = 0.000e+00 (0) + 2: mip = not found yet <= +inf (1; 0) + 2: >>>>> 2.400000000e+00 <= 2.400000000e+00 0.0% (1; 0) + 2: mip = 2.400000000e+00 <= tree is empty 0.0% (0; 1) 2.4000000000000004 ********************************************************************** 1 item had failures: 1 of 10 in sage.libs.glpk.error.setup_glpk_error_handler [11 tests, 1 failure, 1.10 s]
comment:7 Changed 5 years ago by
 Commit changed from 49bab5b43179cf847d2b18adcb398a50b058bbf6 to 75e8fe2131b6751e25917bb9c195ff55c310dc0c
Branch pushed to git repo; I updated commit sha1. New commits:
75e8fe2  Make GLPK verbose doctest more robust

comment:8 Changed 5 years ago by
 Status changed from needs_work to needs_review
comment:9 Changed 5 years ago by
 Status changed from needs_review to positive_review
comment:10 Changed 5 years ago by
 Branch changed from u/jdemeyer/add_a_doctest_for_glpk_error_handling_and_verbose_output to 75e8fe2131b6751e25917bb9c195ff55c310dc0c
 Resolution set to fixed
 Status changed from positive_review to closed
New commits:
Add a doctest for GLPK error handling and verbose output