[R] avoid leaving test files behind (#8685)
This commit is contained in:
parent
e7d612d22c
commit
e227abc57a
6
.gitignore
vendored
6
.gitignore
vendored
@ -143,3 +143,9 @@ demo/**/*.txt
|
|||||||
.hypothesis
|
.hypothesis
|
||||||
__MACOSX/
|
__MACOSX/
|
||||||
model*.json
|
model*.json
|
||||||
|
|
||||||
|
# R tests
|
||||||
|
*.libsvm
|
||||||
|
*.rds
|
||||||
|
Rplots.pdf
|
||||||
|
*.zip
|
||||||
|
|||||||
@ -70,7 +70,7 @@ test_that("xgb.DMatrix: saving, loading", {
|
|||||||
|
|
||||||
# from a libsvm text file
|
# from a libsvm text file
|
||||||
tmp <- c("0 1:1 2:1", "1 3:1", "0 1:1")
|
tmp <- c("0 1:1 2:1", "1 3:1", "0 1:1")
|
||||||
tmp_file <- 'tmp.libsvm'
|
tmp_file <- tempfile(fileext = ".libsvm")
|
||||||
writeLines(tmp, tmp_file)
|
writeLines(tmp, tmp_file)
|
||||||
dtest4 <- xgb.DMatrix(tmp_file, silent = TRUE)
|
dtest4 <- xgb.DMatrix(tmp_file, silent = TRUE)
|
||||||
expect_equal(dim(dtest4), c(3, 4))
|
expect_equal(dim(dtest4), c(3, 4))
|
||||||
|
|||||||
@ -59,11 +59,12 @@ test_that("Models from previous versions of XGBoost can be loaded", {
|
|||||||
bucket <- 'xgboost-ci-jenkins-artifacts'
|
bucket <- 'xgboost-ci-jenkins-artifacts'
|
||||||
region <- 'us-west-2'
|
region <- 'us-west-2'
|
||||||
file_name <- 'xgboost_r_model_compatibility_test.zip'
|
file_name <- 'xgboost_r_model_compatibility_test.zip'
|
||||||
zipfile <- file.path(getwd(), file_name)
|
zipfile <- tempfile(fileext = ".zip")
|
||||||
model_dir <- file.path(getwd(), 'models')
|
extract_dir <- tempdir()
|
||||||
download.file(paste('https://', bucket, '.s3-', region, '.amazonaws.com/', file_name, sep = ''),
|
download.file(paste('https://', bucket, '.s3-', region, '.amazonaws.com/', file_name, sep = ''),
|
||||||
destfile = zipfile, mode = 'wb', quiet = TRUE)
|
destfile = zipfile, mode = 'wb', quiet = TRUE)
|
||||||
unzip(zipfile, overwrite = TRUE)
|
unzip(zipfile, exdir = extract_dir, overwrite = TRUE)
|
||||||
|
model_dir <- file.path(extract_dir, 'models')
|
||||||
|
|
||||||
pred_data <- xgb.DMatrix(matrix(c(0, 0, 0, 0), nrow = 1, ncol = 4))
|
pred_data <- xgb.DMatrix(matrix(c(0, 0, 0, 0), nrow = 1, ncol = 4))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user