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: sage-7.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:

Status badges

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 jdemeyer

  • Branch set to u/jdemeyer/add_a_doctest_for_glpk_error_handling_and_verbose_output

comment:2 Changed 5 years ago by jdemeyer

  • Commit set to 49bab5b43179cf847d2b18adcb398a50b058bbf6
  • Status changed from new to needs_review

New commits:

49bab5bAdd a doctest for GLPK error handling and verbose output

comment:3 follow-up: Changed 5 years ago by mkoeppe

  • 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 jdemeyer

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 mkoeppe

How about

      0: obj ...

comment:6 Changed 5 years ago by vbraun

  • 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 git

  • Commit changed from 49bab5b43179cf847d2b18adcb398a50b058bbf6 to 75e8fe2131b6751e25917bb9c195ff55c310dc0c

Branch pushed to git repo; I updated commit sha1. New commits:

75e8fe2Make GLPK verbose doctest more robust

comment:8 Changed 5 years ago by jdemeyer

  • Status changed from needs_work to needs_review

comment:9 Changed 5 years ago by mkoeppe

  • Status changed from needs_review to positive_review

comment:10 Changed 5 years ago by vbraun

  • 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
Note: See TracTickets for help on using tickets.