Skip to content

Instantly share code, notes, and snippets.

@ChrisRackauckas
Created April 3, 2019 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChrisRackauckas/65af761f6637de0b27ab7c18116b1793 to your computer and use it in GitHub Desktop.
Save ChrisRackauckas/65af761f6637de0b27ab7c18116b1793 to your computer and use it in GitHub Desktop.
macro test_allowed_failure(ex, kws...)
test_expr!("@test_allowed_failure", ex, kws...)
orig_ex = Expr(:inert, ex)
result = Test.get_test_result(ex, __source__)
# code to call do_test with execution result and original expr
:(do_allowedfailure_test($result, $orig_ex))
end
function do_allowedfailure_test(result::Test.ExecutionResult, orig_expr)
testres = Test.Broken(:test, orig_expr)
# Assume the test is broken and only change if the result is true
if isa(result, Test.Returned)
value = result.value
if isa(value, Bool) && value # if it is a pass, keep it
testres = result
end
end
Test.record(Test.get_testset(), testres)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment