Skip to content
Snippets Groups Projects
Commit 91d801ac authored by Laura A DeCicco's avatar Laura A DeCicco
Browse files

Trying to get CRAN tests to work on travis.

parent 6b7c33ee
No related branches found
No related tags found
1 merge request!81New testing
...@@ -7,6 +7,7 @@ os: ...@@ -7,6 +7,7 @@ os:
- linux - linux
env: env:
NOT_CRAN="true"
global: global:
- CRAN: http://cran.rstudio.com - CRAN: http://cran.rstudio.com
- R_BUILD_ARGS="--no-build-vignettes --no-manual" - R_BUILD_ARGS="--no-build-vignettes --no-manual"
...@@ -21,6 +22,7 @@ before_script: ...@@ -21,6 +22,7 @@ before_script:
- "./travis-tool.sh bootstrap" - "./travis-tool.sh bootstrap"
- "./travis-tool.sh install_deps - ./travis-tool.sh install_r XML RCurl plyr reshape2 lubridate httr knitr xtable" - "./travis-tool.sh install_deps - ./travis-tool.sh install_r XML RCurl plyr reshape2 lubridate httr knitr xtable"
on_failure: on_failure:
- "./travis-tool.sh dump_logs" - "./travis-tool.sh dump_logs"
......
...@@ -9,11 +9,52 @@ test_that("Unit value data returns correct types", { ...@@ -9,11 +9,52 @@ test_that("Unit value data returns correct types", {
endDate <- "2014-10-10" endDate <- "2014-10-10"
rawData <- readNWISuv(siteNumber,parameterCd,startDate,endDate) rawData <- readNWISuv(siteNumber,parameterCd,startDate,endDate)
rawData <- renameNWISColumns(rawData)
timeZoneChange <- readNWISuv(c('04024430','04024000'),parameterCd, timeZoneChange <- readNWISuv(c('04024430','04024000'),parameterCd,
"2013-11-03","2013-11-03") "2013-11-03","2013-11-03",
tz="America/Chicago")
timeZoneChange <- renameNWISColumns(timeZoneChange)
expect_is(rawData$dateTime, 'POSIXct') expect_is(rawData$dateTime, 'POSIXct')
expect_is(rawData$Flow_Inst, 'numeric')
expect_that(attr(rawData, "url"), equals(
"http://nwis.waterservices.usgs.gov/nwis/iv/?site=05114000&format=waterml,1.1&ParameterCd=00060&startDT=2014-10-10&endDT=2014-10-10")
)
#First switchover to standard time:
expect_that(as.numeric(timeZoneChange[which(timeZoneChange$tz_cd == "CST")[1],"dateTime"]),
equals(as.numeric(as.POSIXct("2013-11-03 01:00:00", tz="UTC")+60*60*6)))
})
context("importRDB")
test_that("CRAN-friendly importRDB test", {
filePath <- system.file("extdata", package="dataRetrieval")
fileName <- "RDB1Example.txt"
fullPath <- file.path(filePath, fileName)
importUserRDB <- importRDB1(fullPath)
# default is to turn dates to characters
expect_is(importUserRDB$datetime, 'character')
}) })
\ No newline at end of file
context("Peak, rating, meas")
test_that("peak, rating curves, surface-water measurements", {
testthat::skip_on_cran()
siteNumbers <- c('01594440','040851325')
data <- readNWISpeak(siteNumbers)
expect_is(data$agency_cd, 'character')
#Rating curvs:
siteNumber <- '01594440'
data <- readNWISrating(siteNumber, "base")
expect_that(length(attr(data, "RATING")),equals(7))
#Surface meas:
siteNumbers <- c('01594440','040851325')
data <- readNWISmeas(siteNumbers)
expect_is(data$agency_cd, 'character')
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment