Skip to content

Commit 8168fe5

Browse files
author
cafreeman
committed
add unlink to repeated tempfile cases
1 parent a582810 commit 8168fe5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/inst/tests/test_sparkSQL.R

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ test_that("insertInto() on a registered table", {
8686
expect_true(count(sql(sqlCtx, "select * from table1")) == 2)
8787
expect_true(first(sql(sqlCtx, "select * from table1"))$name == "Bob")
8888
dropTempTable(sqlCtx, "table1")
89+
unlink(parquetPath)
90+
unlink(jsonPath2)
91+
unlink(parquetPath2)
8992
})
9093

9194
test_that("table() returns a new DataFrame", {
@@ -272,6 +275,7 @@ test_that("distinct() on DataFrames", {
272275
uniques <- distinct(df)
273276
expect_true(inherits(uniques, "DataFrame"))
274277
expect_true(count(uniques) == 3)
278+
unlink(jsonPathWithDup)
275279
})
276280

277281
test_that("sampleDF on a DataFrame", {
@@ -326,6 +330,7 @@ test_that("save() as parquet file", {
326330
df2 <- loadDF(sqlCtx, parquetPath, "parquet")
327331
expect_true(inherits(df2, "DataFrame"))
328332
expect_true(count(df2) == 3)
333+
unlink(parquetPath)
329334
})
330335

331336
test_that("test HiveContext", {
@@ -346,6 +351,7 @@ test_that("test HiveContext", {
346351
df3 <- sql(hiveCtx, "select * from json")
347352
expect_true(inherits(df3, "DataFrame"))
348353
expect_true(count(df3) == 6)
354+
unlink(jsonPath2)
349355
})
350356

351357
test_that("column operators", {
@@ -443,6 +449,7 @@ test_that("join() on a DataFrame", {
443449
expect_equal(names(joined4), c("newAge", "name", "test"))
444450
expect_true(count(joined4) == 4)
445451
expect_true(first(joined4)$newAge == 24)
452+
unlink(jsonPath2)
446453
})
447454

448455
test_that("toJSON() returns an RDD of the correct values", {
@@ -487,6 +494,7 @@ test_that("unionAll(), subtract(), and intersect() on a DataFrame", {
487494
expect_true(inherits(unioned, "DataFrame"))
488495
expect_true(count(intersected) == 1)
489496
expect_true(first(intersected)$name == "Andy")
497+
unlink(jsonPath2)
490498
})
491499

492500
test_that("withColumn() and withColumnRenamed()", {

0 commit comments

Comments
 (0)