Skip to content

Commit 0fe66d2

Browse files
committed
fix seed for cran 2
1 parent 6649a00 commit 0fe66d2

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

tests/testthat.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ library(testthat)
55
if (identical(Sys.getenv("TRAVIS"), "true") || identical(Sys.getenv("R_EXPENSIVE_TEST_OK"), "true")) {
66
test_check("mlrMBO")
77
} else {
8-
set.seed(1)
98
test_check("mlrMBO", filter = "((mbo_rf)|(mbo_km))")
109
}

tests/testthat/helper_zzz.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# We want to run on cran with a fixed seed (1) so that tests will not fail stochastically
22
# For local testing + Travis we want to detect and be able reproduce these so we sample a seed
3-
if (!is.na(Sys.getenv("NOT_CRAN", unset = NA))) {
4-
set.seed(1)
5-
} else {
6-
seed.val = sample(1:10, size = 1)
3+
if (identical(Sys.getenv("TRAVIS"), "true") || identical(Sys.getenv("R_EXPENSIVE_TEST_OK"), "true")) {
4+
seed.val = sample(1:100, size = 1)
75
set.seed(seed.val)
86
# Only on Travis logs we want to see the used seed
97
if (identical(Sys.getenv("TRAVIS"), "true")) {
108
catf("Run test with seed: %i", seed.val)
119
}
10+
} else {
11+
set.seed(1)
1212
}
1313

1414
configureMlr(show.learner.output = FALSE)

0 commit comments

Comments
 (0)