Skip to content

Commit

Permalink
Merge pull request #53 from bkemper24/main
Browse files Browse the repository at this point in the history
testcase updates, drop conda build of 3.4.3
  • Loading branch information
bkemper24 authored Feb 21, 2024
2 parents 84049fb + 9b6a3fe commit c68d3ec
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
4 changes: 1 addition & 3 deletions cicd/tar2conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ def get_supported_versions(platform, r_base):

for item in out:
ver = item['version']
# skip 4.2.0, not supported yet
if (tuple([int(x) for x in ver.split('.')]) < (3, 4, 3)
or tuple([int(x) for x in ver.split('.')]) > (4, 0, 0)):
if (tuple([int(x) for x in ver.split('.')]) < (3, 5, 0)):
continue
# skip mro 3.5.1 due to build issues
if (platform == "linux-64" and r_base == "mro"
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/helper.data_load.R
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ options(cas.gen.function.sig=FALSE, cas.print.messages=FALSE)
#
# Setup connection parameters
#

# Fails in Jenkins due to older version of R not supporting withr:defer
# Uncomment when running tests outside of Jenkins
#withr::defer(swat::cas.terminate(caz), teardown_env())

info <- swat::.getConnectionInfo(NULL, NULL, NULL, NULL, NULL, NULL)
HOSTNAME <- info$hostname
PORT <- info$port
Expand Down Expand Up @@ -92,6 +97,7 @@ s0.1 <- c("aa", "bb", "cc", "dd", "dd", " ")
d.1 <- c('12/31/09', '09/08/78', '12/25/00','04/01/16', NA, '03/08/02')
d.1 <- as.Date(d, "%m/%d/%y")
df0.1 <- data.frame(n1.1, n2.1, n3.1, n4.1, s.1, d.1)
df0_.1 <- data.frame(n1.1, n2.1, n3.1, n4.1, s0.1, d.1)

# Create data frame with missing values
n1 <- c(2, 3, 5, NA, 5, 598)
Expand Down Expand Up @@ -125,6 +131,7 @@ ct <- as.casTable(caz, df, casOut=list(replace=TRUE))
i2 <- as.casTable(caz, iris, casOut=list(replace=TRUE))
df.ct <- as.casTable(caz, df_, casOut=list(replace=TRUE))
df0.ct <- as.casTable(caz, df0_, casOut=list(replace=TRUE))
df0_1.ct <- as.casTable(caz, df0_.1, casOut=list(replace=TRUE))

ctn <- as.casTable(caz, dfn, casOut=list(replace=TRUE))

Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test.analysis_compvars.R
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,7 @@ test_that("cor, cov", {
})

test_that("summary", {
skip("fails in Jenkins")
# summary(df_cmp) is incorrect in several places when run in Jenkins with R3.5 ( 3.6+ is ok )
expect_true(all.equal(summary(ct_cmp[c(1:4,7:8)]), summary(df_cmp[c(1:4,7:8)], quantile.type = 2), check.attributes = FALSE))
})
18 changes: 14 additions & 4 deletions tests/testthat/test.rswat.R
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ test_that("connection patterns", {
expect_true(exists("s3"))
s4 <- CAS$new(HOSTNAME, PORT, USERNAME, PASSWORD, protocol=PROTOCOL)
expect_true(exists("s4"))
s1$close()
s2$close()
s3$close()
s4$close()
swat::cas.terminate(s1)
swat::cas.terminate(s2)
swat::cas.terminate(s3)
swat::cas.terminate(s4)
})

test_that('test.results', {
Expand Down Expand Up @@ -74,6 +74,7 @@ test_that("test.copy_connection", {
expect_true(grepl("^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$",
s2$session, perl = TRUE))
expect_true(caz$soptions == s2$soptions)
swat::cas.terminate(s2)
})

test_that("test.fork_connection", {
Expand All @@ -98,6 +99,10 @@ test_that("test.fork_connection", {
expect_true(grepl("^[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}$",
slist[[3]]$session, perl = TRUE))
expect_true(slist[[3]]$soptions == caz$soptions)

# Note, slist[[1]] is the original connection. Don't terminate
swat::cas.terminate(slist[[2]])
swat::cas.terminate(slist[[3]])
})

test_that("test.connect_with_bad_session", {
Expand All @@ -109,6 +114,7 @@ test_that("test.set_session_locale", {
u = CAS(HOSTNAME, PORT, USERNAME, PASSWORD, protocol = PROTOCOL,
locale = "es_US")
expect_true(grepl("\\blocale=es_US\\b", u$soptions, perl = TRUE))
swat::cas.terminate(u)
})

test_that("test.set_bad_session_locale", {
Expand Down Expand Up @@ -366,6 +372,10 @@ test_that("test.test_multiple_connection_retrieval", {
expect_true(f1Found)
expect_true(f2Found)
expect_true(f3Found)

# note f[[1]] is the original connection, not a copy. Don't terminate.
swat::cas.terminate(f[[2]])
swat::cas.terminate(f[[3]])
})

test_that("test.test_addtable", {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test.table_functions.R
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ test_that("unique", {
# Numeric uniques
expect_is(unique(i2[1]), "numeric")
expect_is(unique(i2$Sepal.Length), "numeric")
expect_equivalent(unique(i2[1]), unique(i2$Sepal.Length))
expect_setequal(unique(i2[1]), unique(i2$Sepal.Length))

# Character uniques
expect_is(unique(i2[5]), "character")
expect_is(unique(i2$Species), "character")
expect_equivalent(unique(i2[5]), unique(i2$Species))
expect_setequal(unique(i2[5]), unique(i2$Species))

# unique(CASTable) returns sorted values. unique(data.frame) does not.
expect_failure(expect_equivalent(unique(i2$Sepal.Width), unique(iris$Sepal.Width)))
Expand Down

0 comments on commit c68d3ec

Please sign in to comment.