Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a doctest for GLPK error handling and verbose output #20832

Closed
jdemeyer opened this issue Jun 15, 2016 · 11 comments
Closed

Add a doctest for GLPK error handling and verbose output #20832

jdemeyer opened this issue Jun 15, 2016 · 11 comments

Comments

@jdemeyer
Copy link

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.

CC: @kiwifb

Component: doctest coverage

Author: Jeroen Demeyer

Branch/Commit: 75e8fe2

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/20832

@jdemeyer jdemeyer added this to the sage-7.3 milestone Jun 15, 2016
@jdemeyer
Copy link
Author

@jdemeyer
Copy link
Author

New commits:

49bab5bAdd a doctest for GLPK error handling and verbose output

@jdemeyer
Copy link
Author

Commit: 49bab5b

@mkoeppe
Copy link
Member

mkoeppe commented Jun 24, 2016

comment:3

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.

@mkoeppe
Copy link
Member

mkoeppe commented Jun 24, 2016

Reviewer: Matthias Koeppe

@jdemeyer
Copy link
Author

comment:4

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.

@mkoeppe
Copy link
Member

mkoeppe commented Jun 25, 2016

comment:5

How about

      0: obj ...

@vbraun
Copy link
Member

vbraun commented Jun 25, 2016

comment:6
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]

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 25, 2016

Changed commit from 49bab5b to 75e8fe2

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Jun 25, 2016

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

75e8fe2Make GLPK verbose doctest more robust

@vbraun
Copy link
Member

vbraun commented Jun 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants