Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Mar 28, 2024
1 parent 944406e commit c3ff093
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@ using Test
using Xpress

function test_licensing()
ret = ENV["XPAUTH_PATH"]
# Create a bogus license file
xpauth_path = mktempdir()
filename = joinpath(xpauth_path, "xpauth.xpr")
write(filename, "bogus_license")
# Test that passing `""` can find our current license. This should already
# be the case because we managed to install and start the tests...
@test isfile(Xpress._get_xpauthpath("", false))
delete!(ENV, "XPAUTH_PATH")
# Test that using the test directory cannot find a license.
@test_throws ErrorException Xpress._get_xpauthpath(@__DIR__, false)
# Now're going to test checking for new licenses. To do so, we first need to
Expand All @@ -29,6 +31,7 @@ function test_licensing()
# Then, we can check that using the root fails to find a license
@test_throws Xpress.XpressError Xpress.initialize(; xpauth_path)
# Now we need to re-initialize the license so that we can run other tests.
ENV["XPAUTH_PATH"] = ret
Xpress.initialize()
return
end
Expand Down

0 comments on commit c3ff093

Please sign in to comment.