MAiNGO-github / MAiNGO.jl

A Julia Wrapper to use MAiNGO with JuMP
MIT License
3 stars 1 forks source link

Separate test dependencies in Project.toml #5

Closed odow closed 8 months ago

odow commented 8 months ago

JuMP is a test dependency. It isn't needed for general operations.

odow commented 8 months ago

So #4 is going to show the tests are failing:

Gear          |    5      5  0.0s
MINLP: Test Failed at /Users/oscar/.julia/dev/MAiNGO/test/minlp.jl:33
  Expression: isapprox(value(x[1]), 1.300975890892825, rtol = 1.0e-6)
   Evaluated: isapprox(1.3004898480384113, 1.300975890892825; rtol = 1.0e-6)

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.1+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/.julia/dev/MAiNGO/test/minlp.jl:33 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.1+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/.julia/dev/MAiNGO/test/minlp.jl:33
MINLP: Test Failed at /Users/oscar/.julia/dev/MAiNGO/test/minlp.jl:35
  Expression: isapprox(value(x[3]), 1.0, rtol = 1.0e-6)
   Evaluated: isapprox(0.9996834548021118, 1.0; rtol = 1.0e-6)

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.1+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/.julia/dev/MAiNGO/test/minlp.jl:35 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.1+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/.julia/dev/MAiNGO/test/minlp.jl:33
MINLP: Test Failed at /Users/oscar/.julia/dev/MAiNGO/test/minlp.jl:39
  Expression: isapprox(objective_value(m), 6.00975890893, rtol = 1.0e-6)
   Evaluated: isapprox(6.011158326116291, 6.00975890893; rtol = 1.0e-6)

Stacktrace:
 [1] macro expansion
   @ ~/.julia/juliaup/julia-1.10.1+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:672 [inlined]
 [2] macro expansion
   @ ~/.julia/dev/MAiNGO/test/minlp.jl:39 [inlined]
 [3] macro expansion
   @ ~/.julia/juliaup/julia-1.10.1+0.x64.apple.darwin14/share/julia/stdlib/v1.10/Test/src/Test.jl:1577 [inlined]
 [4] top-level scope
   @ ~/.julia/dev/MAiNGO/test/minlp.jl:33
Test Summary: | Pass  Fail  Total  Time
MINLP         |    4     3      7  0.5s
ERROR: LoadError: Some tests did not pass: 4 passed, 3 failed, 0 errored, 0 broken.
in expression starting at /Users/oscar/.julia/dev/MAiNGO/test/minlp.jl:1
in expression starting at /Users/oscar/.julia/dev/MAiNGO/test/runtests.jl:4
ERROR: Package MAiNGO errored during testing
MAiNGO-github commented 8 months ago

Hi, thanks for making the effort for this merge request.

I got a question regarding the imports. Going from relative imports using ..MAiNGO to absolute imports using MAiNGO isn't quite clear to me, since we want to refer to the local code. As you might have guessed, I am not 100% familiar with the way GitHub Actions work. Locally, these relative paths cause errors for me

>julia test/runtests.jl
ERROR: LoadError: ArgumentError: Package MAiNGO not found in current path.
- Run `import Pkg; Pkg.add("MAiNGO")` to install the MAiNGO package.

is there a reason why you prefer them? Maybe it has to be this way for the GitHub Action to work, but then is there a convenient way to run the tests locally?

odow commented 8 months ago

You can run the tests with import Pkg; Pkg.test("MAiNGO"), or ] test MAiNGO.

See:

(base) oscar@Oscars-MBP MAiNGO % julia --project=.
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.10.1 (2024-02-13)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(MAiNGO) pkg> st
Project MAiNGO v0.2.0
Status `~/.julia/dev/MAiNGO/Project.toml`
  [682c06a0] JSON v0.21.4
  [b8f27783] MathOptInterface v1.27.0
  [6ab0fed5] MAiNGO_jll v0.7.2+0
  [8f399da3] Libdl
  [8dfed614] Test

julia> import Pkg

julia> Pkg.test("MAiNGO")
     Testing MAiNGO
... lots of stuff omitted ...
odow commented 8 months ago

Okay, interesting. This works on linux, but not in Mac or Windows.

One option is that this is intended/a known problem and we relax the tolerances in the tests.

Another option is that there is some issue in your upstream library?