From f14398ddd371421e328db14a9e0acc50df7813e4 Mon Sep 17 00:00:00 2001 From: Eric Hanson <5846501+ericphanson@users.noreply.github.com> Date: Thu, 18 Aug 2022 15:50:15 +0200 Subject: [PATCH 1/3] fix tests on 1.8 --- test/robust_pmap.jl | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/test/robust_pmap.jl b/test/robust_pmap.jl index 501618b..e4aec58 100644 --- a/test/robust_pmap.jl +++ b/test/robust_pmap.jl @@ -17,7 +17,11 @@ # Check other errors don't retry throw_isodd = make_throw_isodd(ErrorException("Error")) - @test_throws ErrorException robust_pmap(throw_isodd, input) + if VERSION < v"1.8-" + @test_throws ErrorException robust_pmap(throw_isodd, input) + else + @test_throws "Error" robust_pmap(throw_isodd, input) + end # Check ProcessExitedException is retried throw_isodd = make_throw_isodd(ProcessExitedException()) @@ -27,8 +31,12 @@ @test_log LOGGER "info" ("Retrying", "ProcessExitedException") robust_pmap(throw_isodd, input) # Check with lower number of retrys throw_isodd = make_throw_isodd(ProcessExitedException()) - @test_throws ProcessExitedException robust_pmap(throw_isodd, input, num_retries=1) + if VERSION < v"1.8-" + @test_throws ProcessExitedException robust_pmap(throw_isodd, input, num_retries=1) + else + @test_throws "ProcessExitedException" robust_pmap(throw_isodd, input, num_retries=1) + end # ArgumentErrors with this message should be retried throw_isodd = make_throw_isodd(ArgumentError("stream is closed or unusable")) @test robust_pmap(throw_isodd, input) == expected @@ -37,11 +45,19 @@ @test_log LOGGER "info" ("Retrying", "ArgumentError") robust_pmap(throw_isodd, input) # Check with lower number of retrys throw_isodd = make_throw_isodd(ArgumentError("stream is closed or unusable")) - @test_throws ArgumentError robust_pmap(throw_isodd, input, num_retries=1) + if VERSION < v"1.8-" + @test_throws ArgumentError robust_pmap(throw_isodd, input, num_retries=1) + else + @test_throws "stream is closed or unusable" robust_pmap(throw_isodd, input, num_retries=1) + end # Other ArgumentErrors should not be retried throw_isodd = make_throw_isodd(ArgumentError("stream is open but other stuff is wrong")) - @test_throws ArgumentError robust_pmap(throw_isodd, input) + if VERSION < v"1.8-" + @test_throws ArgumentError robust_pmap(throw_isodd, input) + else + @test_throws "stream is open but other stuff is wrong" robust_pmap(throw_isodd, input) + end # No retries should mean no log of retries throw_isodd = make_throw_isodd(ArgumentError("stream is open but other stuff is wrong")) @test_nolog LOGGER "info" "Retrying" try robust_pmap(throw_isodd, input) catch end @@ -54,5 +70,9 @@ @test_log LOGGER "info" ("Retrying", "IOError") robust_pmap(throw_isodd, input) # Check with lower number of retrys throw_isodd = make_throw_isodd(Base.IOError("msg", 1)) - @test_throws Base.IOError robust_pmap(throw_isodd, input, num_retries=1) + if VERSION < v"1.8-" + @test_throws Base.IOError robust_pmap(throw_isodd, input, num_retries=1) + else + @test_throws "msg" robust_pmap(throw_isodd, input, num_retries=1) + end end From 6bdefad56c3756417fd3bd048e4757c773bea4fd Mon Sep 17 00:00:00 2001 From: Eric Hanson <5846501+ericphanson@users.noreply.github.com> Date: Thu, 18 Aug 2022 16:06:53 +0200 Subject: [PATCH 2/3] format --- .JuliaFormatter.toml | 1 + test/robust_pmap.jl | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 .JuliaFormatter.toml diff --git a/.JuliaFormatter.toml b/.JuliaFormatter.toml new file mode 100644 index 0000000..323237b --- /dev/null +++ b/.JuliaFormatter.toml @@ -0,0 +1 @@ +style = "blue" diff --git a/test/robust_pmap.jl b/test/robust_pmap.jl index e4aec58..3ffe68c 100644 --- a/test/robust_pmap.jl +++ b/test/robust_pmap.jl @@ -10,7 +10,7 @@ i += 1 throw(err) end - isodd(x) + return isodd(x) end return throw_isodd end @@ -28,7 +28,9 @@ @test robust_pmap(throw_isodd, input) == expected # Check retries are logged throw_isodd = make_throw_isodd(ProcessExitedException()) - @test_log LOGGER "info" ("Retrying", "ProcessExitedException") robust_pmap(throw_isodd, input) + @test_log LOGGER "info" ("Retrying", "ProcessExitedException") robust_pmap( + throw_isodd, input + ) # Check with lower number of retrys throw_isodd = make_throw_isodd(ProcessExitedException()) if VERSION < v"1.8-" @@ -48,7 +50,9 @@ if VERSION < v"1.8-" @test_throws ArgumentError robust_pmap(throw_isodd, input, num_retries=1) else - @test_throws "stream is closed or unusable" robust_pmap(throw_isodd, input, num_retries=1) + @test_throws "stream is closed or unusable" robust_pmap( + throw_isodd, input, num_retries=1 + ) end # Other ArgumentErrors should not be retried @@ -56,11 +60,16 @@ if VERSION < v"1.8-" @test_throws ArgumentError robust_pmap(throw_isodd, input) else - @test_throws "stream is open but other stuff is wrong" robust_pmap(throw_isodd, input) + @test_throws "stream is open but other stuff is wrong" robust_pmap( + throw_isodd, input + ) end # No retries should mean no log of retries throw_isodd = make_throw_isodd(ArgumentError("stream is open but other stuff is wrong")) - @test_nolog LOGGER "info" "Retrying" try robust_pmap(throw_isodd, input) catch end + @test_nolog LOGGER "info" "Retrying" try + robust_pmap(throw_isodd, input) + catch + end # Check IOError is retried throw_isodd = make_throw_isodd(Base.IOError("msg", 1)) From f8d69235e4582d217e1e4de2e94ad997074b3646 Mon Sep 17 00:00:00 2001 From: Eric Hanson <5846501+ericphanson@users.noreply.github.com> Date: Fri, 19 Aug 2022 17:13:10 +0200 Subject: [PATCH 3/3] Update robust_pmap.jl --- test/robust_pmap.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/robust_pmap.jl b/test/robust_pmap.jl index 3ffe68c..9b1f125 100644 --- a/test/robust_pmap.jl +++ b/test/robust_pmap.jl @@ -16,11 +16,11 @@ end # Check other errors don't retry - throw_isodd = make_throw_isodd(ErrorException("Error")) + throw_isodd = make_throw_isodd(ErrorException("Error123")) if VERSION < v"1.8-" @test_throws ErrorException robust_pmap(throw_isodd, input) else - @test_throws "Error" robust_pmap(throw_isodd, input) + @test_throws "Error123" robust_pmap(throw_isodd, input) end # Check ProcessExitedException is retried