change fakedata rng in tests

This commit is contained in:
t-bltg 2021-07-23 11:31:30 +02:00
parent cd06648ec3
commit f3aa61293b
5 changed files with 8 additions and 6 deletions

View File

@ -31,7 +31,6 @@ SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
[compat]
Contour = "0.5"
@ -66,6 +65,7 @@ OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
RDatasets = "ce6b1742-4840-55fa-b093-852dadbb1d8b"
StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StatsPlots = "f3b207a7-027a-5e70-b257-86293d7955fd"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@ -74,4 +74,4 @@ UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228"
VisualRegressionTests = "34922c18-7c2a-561c-bac1-01e79b2c4c92"
[targets]
test = ["Distributions", "FileIO", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "HDF5", "RDatasets", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "VisualRegressionTests"]
test = ["Distributions", "FileIO", "Gtk", "ImageMagick", "Images", "LibGit2", "OffsetArrays", "PGFPlotsX", "PlotlyJS", "HDF5", "RDatasets", "StableRNGs", "StaticArrays", "StatsPlots", "Test", "TestImages", "UnicodePlots", "VisualRegressionTests"]

View File

@ -11,7 +11,6 @@ using Reexport
import GeometryBasics
using Dates, Printf, Statistics, Base64, LinearAlgebra, Random
using SparseArrays
using StableRNGs
using FFMPEG

View File

@ -303,7 +303,9 @@ function convert_to_polar(theta, r, r_extrema = ignorenan_extrema(r))
x, y
end
function fakedata(sz...; rng=Random.GLOBAL_RNG(PLOTS_SEED))
fakedata(sz::Int...) = fakedata(Random.seed!(PLOTS_SEED), sz...)
function fakedata(rng::AbstractRNG, sz...)
y = zeros(sz...)
for r in 2:size(y,1)
y[r,:] = 0.95 * vec(y[r-1,:]) + randn(rng, size(y,2))

View File

@ -6,7 +6,7 @@ function replace_rand!(ex::Expr)
for arg in ex.args
replace_rand!(arg)
end
if ex.head === :call && ex.args[1] (:rand, :randn)
if ex.head === :call && ex.args[1] (:rand, :randn, :(Plots.fakedata))
pushfirst!(ex.args, ex.args[1])
ex.args[2] = :rng
end
@ -35,6 +35,7 @@ function image_comparison_tests(
fn = "ref$idx.png"
reffn = reference_file(pkg, idx, _current_plots_version)
newfn = joinpath(reference_path(pkg, _current_plots_version), fn)
@debug example.exprs
# test function
func = (fn, idx) -> begin

View File

@ -3,6 +3,7 @@ import ImageMagick
using VisualRegressionTests
using Plots
using Random
using StableRNGs
using Test
using TestImages
using FileIO
@ -11,7 +12,6 @@ using LibGit2
import GeometryBasics
using Dates
using RecipesBase
using StableRNGs
@testset "Plotly standalone" begin
@test_nowarn Plots._init_ijulia_plotting()