[Stacomir-commits] r419 - in pkg/stacomir: . R inst/tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jun 25 14:44:08 CEST 2017


Author: briand
Date: 2017-06-25 14:44:07 +0200 (Sun, 25 Jun 2017)
New Revision: 419

Modified:
   pkg/stacomir/DESCRIPTION
   pkg/stacomir/R/ref_year.R
   pkg/stacomir/inst/tests/testthat/test-03-report_df.R
   pkg/stacomir/inst/tests/testthat/test-04-report_dc.R
   pkg/stacomir/inst/tests/testthat/test-05-report_sample_char.R
   pkg/stacomir/inst/tests/testthat/test-06-report_mig_interannual.R
   pkg/stacomir/inst/tests/testthat/test-07-report_sea_age.R
   pkg/stacomir/inst/tests/testthat/test-08-report_silver_eel.R
   pkg/stacomir/inst/tests/testthat/test-09-report_annual.R
   pkg/stacomir/inst/tests/testthat/test-10-report_env.R
   pkg/stacomir/inst/tests/testthat/test-11-report_mig_env.R
   pkg/stacomir/inst/tests/testthat/test-12-report_mig_char.R
   pkg/stacomir/inst/tests/testthat/test-13-report_species.R
Log:


Modified: pkg/stacomir/DESCRIPTION
===================================================================
--- pkg/stacomir/DESCRIPTION	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/DESCRIPTION	2017-06-25 12:44:07 UTC (rev 419)
@@ -9,8 +9,9 @@
     monitoring. It is a part of the 'STACOMI' open source project developed in
     France by the French Agency for Biodiversity (AFB) institute to centralize
     data obtained by fish pass monitoring. Version 0.5.3 is available in French and
-    English.
+    English. 
 License: GPL (>= 2)
+URL: http://stacomir.r-forge.r-project.org/
 Collate:
     'create_generic.R'
     'data.R'

Modified: pkg/stacomir/R/ref_year.R
===================================================================
--- pkg/stacomir/R/ref_year.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/R/ref_year.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -191,7 +191,7 @@
 	  if ( !annee %in% object at data[,1] ) {
 		
 		warning(stringr::str_c("Attention, year ",annee," is not available in the database, available years :",
-				ifelse(length(object at data$bjo_annee)==0,gettext(" none, were you lazy?",domain="R-stacomiR"),
+				ifelse(length(object at data$bjo_annee)==0,gettext(" none", domain="R-stacomiR"),
 					stringr::str_c(object at data$bjo_annee,collapse=","))))
 	  }
 	  object at annee_selectionnee<-annee

Modified: pkg/stacomir/inst/tests/testthat/test-03-report_df.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-03-report_df.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-03-report_df.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -26,7 +26,7 @@
 			  horodatedebut="2013 01 011",
 			  horodatefin="2013-12-31",
 			  silent=TRUE))			
-	  
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("report_df charge method works",{
@@ -47,7 +47,8 @@
 		  silent=TRUE)
 	  r_df<-charge(r_df,silent=TRUE)
 	  r_df<-connect(r_df,silent=TRUE)
-	  expect_equal(nrow(r_df at data),5)			
+	  expect_equal(nrow(r_df at data),5)		
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)    
 	})
 
 
@@ -60,6 +61,7 @@
 	  plot(r_df,plot.type="2",silent=TRUE,main="An example title")
 	  plot(r_df,plot.type="3",silent=TRUE,main="An example title")	
 	  plot(r_df,plot.type="4",silent=TRUE,main="An example title")	
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -69,6 +71,7 @@
 	  data(r_df)
 	  r_df<-r_df
 	  expect_output(summary(r_df,silent=FALSE),"summary")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -78,4 +81,5 @@
 	  data(r_df)
 	  r_df<-r_df
 	  expect_output(print(r_df))
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
\ No newline at end of file

Modified: pkg/stacomir/inst/tests/testthat/test-04-report_dc.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-04-report_dc.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-04-report_dc.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -25,7 +25,8 @@
 			  5,
 			  horodatedebut="2013 01 011",
 			  horodatefin="2013-12-31",
-			  silent=TRUE))			
+			  silent=TRUE))		
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)    
 	  
 	})
 
@@ -47,7 +48,8 @@
 		  silent=TRUE)
 	  r_dc<-charge(r_dc,silent=TRUE)
 	  r_dc<-connect(r_dc,silent=TRUE)
-	  expect_equal(nrow(r_dc at data),7)			
+	  expect_equal(nrow(r_dc at data),7)	
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -60,6 +62,7 @@
 	  plot(r_dc,plot.type="2",silent=TRUE,main="An example title")
 	  plot(r_dc,plot.type="3",silent=TRUE,main="An example title")	
 	  plot(r_dc,plot.type="4",silent=TRUE,main="An example title")	
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -69,6 +72,7 @@
 	  data(r_dc)
 	  r_dc<-r_dc
 	  expect_output(summary(r_dc,silent=FALSE),"summary")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -78,4 +82,5 @@
 	  data(r_dc)
 	  r_dc<-r_dc
 	  expect_output(print(r_dc))
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
\ No newline at end of file

Modified: pkg/stacomir/inst/tests/testthat/test-05-report_sample_char.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-05-report_sample_char.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-05-report_sample_char.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -10,6 +10,7 @@
 	  req<-stacomirtools::connect(req)
 	  result<-req at query	
 	  expect_true(nrow(result)>0)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("Test an instance of report_sample_char loaded with choice_c",{
@@ -36,6 +37,7 @@
 	  #options(warn = 0)
 	  expect_s4_class(r_sample_char,
 		  "report_sample_char")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -64,6 +66,7 @@
 	  r_sample_char<-connect(r_sample_char,silent=TRUE)
 	  expect_true(nrow(r_sample_char at data)>0,label="No data for r_sample_char")
 	  r_sample_char<-calcule(r_sample_char,silent=TRUE)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	  
 	})
 
@@ -92,7 +95,7 @@
 	  r_sample_char<-connect(r_sample_char,silent=TRUE)
 	  r_sample_char<-charge(r_sample_char)
 	  r_sample_char<-calcule(r_sample_char,silent=TRUE)
-	  
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("Test example reportcarlot-example",
@@ -104,6 +107,7 @@
 	  test<-file.access(example_path,0)
 	  if (test[1]!=0) warnings("Package example dir not created ?") else
 		source(example_path)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-06-report_mig_interannual.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-06-report_mig_interannual.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-06-report_mig_interannual.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -26,6 +26,7 @@
 	  # three warning produced, none shown due to silent=TRUE
 	  options(warn = 0)
 	  expect_s4_class(r_mig_interannual,"report_mig_interannual")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -53,6 +54,7 @@
 	  r_mig_interannual<-connect(r_mig_interannual,silent=TRUE)	
 	  summary(object=r_mig_interannual,silent=TRUE)
 	  # two warning produced
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	  
 	})
 
@@ -65,7 +67,7 @@
 	  test<-file.access(example_path,0)
 	  if (test[1]!=0) warnings("Package example dir not created ?") else
 		suppressWarnings(source(example_path))
-	  
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("Test that loading two taxa will fail",
@@ -91,6 +93,7 @@
 			  anneefin=2015,
 			  silent=TRUE))
 	  expect_error(charge(r_mig_interannual))
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	  
 	})
 
@@ -119,7 +122,7 @@
 # deleting all data to ensure everything is loaded
 	  supprime(bmi_cha)
 	  bmi_cha<-connect(bmi_cha,silent=TRUE)
-	  
+	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("Test that different sums are the same, for  report_mig_interannual, report_mig_mult",
@@ -178,4 +181,5 @@
 		  label="The sum of number in the report_mig are different to the
 			  number in the report_annual class"
 	  )		
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})

Modified: pkg/stacomir/inst/tests/testthat/test-07-report_sea_age.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-07-report_sea_age.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-07-report_sea_age.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -21,6 +21,7 @@
 		  ))
 	  # warnings No data for par 1786No data for par 1785
 	  r_seaa<-connect(r_seaa,silent=TRUE)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test that loading bad limits fails",{
@@ -42,6 +43,7 @@
 			  limit2hm="strawberry",
 			  silent=FALSE
 		  ))		
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-08-report_silver_eel.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-08-report_silver_eel.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-08-report_silver_eel.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -19,13 +19,14 @@
         r_silver<-connect(r_silver,silent=TRUE)
 	  # warnings No data for par 1786No data for par 1785
 	  r_silver<-connect(r_silver,silent=TRUE)
-      r_silver<-calcule(r_silver,silent=TRUE)
+      r_silver<-suppressWarnings(calcule(r_silver,silent=TRUE))
       plot(r_silver, plot.type=1)
       plot(r_silver, plot.type=2)
       plot(r_silver, plot.type=3)      
       plot(r_silver, plot.type=4)
 # print a summary statistic, and save the output in a list for later use
       stats<-summary(r_silver,silent=TRUE)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-09-report_annual.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-09-report_annual.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-09-report_annual.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -20,6 +20,7 @@
 		  silent=TRUE)
 	  r_ann<-connect(r_ann,silent=TRUE)	
 	  expect_s4_class(r_ann,"report_annual")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -45,6 +46,7 @@
 	  plot(r_ann,silent=TRUE)
 	  dev.new()
 	  barplot(r_ann)			
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("Test example report_mig_annual-example",
@@ -56,6 +58,7 @@
 	  test<-file.access(example_path,0)
 	  if (test[1]!=0) warnings("Package example dir not created ?") else
 		suppressWarnings(source(example_path))
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	  
 	})
 
@@ -108,6 +111,7 @@
 	  dev.new()
 	  plot(r_ann_adour,silent=TRUE)
 	  graphics.off()
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
     })
 
 test_that("test xtable method for report_annual",{
@@ -155,6 +159,7 @@
 			  include.rownames = TRUE,
 			  include.colnames = FALSE,
 			  format.args = list(big.mark = " ", decimal.mark = ",")))
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test plot methods for report_annual",{
@@ -171,5 +176,6 @@
 	  dev.new()
 	  plot(r_ann_adour,silent=TRUE)
 	  graphics.off()		
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	  
 	})

Modified: pkg/stacomir/inst/tests/testthat/test-10-report_env.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-10-report_env.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-10-report_env.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -12,6 +12,7 @@
 		  silent=TRUE)	
 	  r_env<-connect(r_env,silent=TRUE)
 	  expect_true(nrow(r_env at data)>0,"The is a problem when loading data in the data slot" )
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test plot method",{
@@ -25,6 +26,7 @@
 		  silent=TRUE)	
 	  r_env<-connect(r_env,silent=TRUE)
 	  r_env<-plot(r_env)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-11-report_mig_env.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-11-report_mig_env.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-11-report_mig_env.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -17,6 +17,7 @@
 	  r_mig_env<-connect(r_mig_env,silent=TRUE)
 	  expect_true(nrow(r_mig_env at report_env@data)>0,"Data not loaded in the report_env part of the object" )
 	  expect_true(nrow(r_mig_env at report_mig_mult@data)>0,"Data not loaded in the report_mig_mult part of the object" )
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test plot method",{
@@ -38,6 +39,7 @@
 	  suppressWarnings(plot(r_mig_env,
 			  color_station=c("temp_gabion"="red","coef_maree"="blue","phases_lune"="pink"),
 			  color_dc=c("5"="yellow","6"="orange","12"="purple"),silent=TRUE))
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-12-report_mig_char.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-12-report_mig_char.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-12-report_mig_char.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -27,6 +27,7 @@
 	  r_mig_char<-connect(r_mig_char)
 	  expect_true(is.null(r_mig_char at data$parqual),label="there should be no data in parqual when not qualitative parm are selected")
 	  expect_true(nrow(r_mig_char at data$parquan)>0,"There should be data in the parquan slot when quantitative parm are selected" )
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test setasqualitative method",{
@@ -63,6 +64,7 @@
 	  expect_false(r_mig_char at parquan@par_selected=='A124', label="The parameter A124 should have been removed from quant parm")
 	  expect_true('A124'%in%r_mig_char at data$parqual$car_par_code)
 	  expect_false('A124'%in%r_mig_char at data$parquan$car_par_code)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 
@@ -97,7 +99,7 @@
 		  silent=TRUE,breaks=c(0,1.5,2.5,10),label=c("age 1","age 2","age 3"))
 	  r_mig_char<-calcule(r_mig_char,silent=TRUE)
 	  expect_true(any(!is.na(r_mig_char at calcdata$car_par_code_qual))&any(!is.na(r_mig_char at calcdata$car_par_code_quan)), label="The merge function works and returns both qualitative and quantitative parameters")
-
+        rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 

Modified: pkg/stacomir/inst/tests/testthat/test-13-report_species.R
===================================================================
--- pkg/stacomir/inst/tests/testthat/test-13-report_species.R	2017-06-24 20:08:23 UTC (rev 418)
+++ pkg/stacomir/inst/tests/testthat/test-13-report_species.R	2017-06-25 12:44:07 UTC (rev 419)
@@ -21,6 +21,7 @@
 	  bilesp<-connect(bilesp,silent=TRUE)
 	  expect_s4_class(bilesp,
 		  "report_species")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test calcule method report_species",{
@@ -42,6 +43,7 @@
 	  bilesp<-connect(bilesp,silent=TRUE)
 	  bilesp<-calcule(bilesp,silent=TRUE)
 	  expect_gt(nrow(bilesp at calcdata),0,"No data in calcdata after running calculations")
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
 test_that("test that plot method works",{
@@ -72,6 +74,7 @@
 		  mycolorrampyellow(5),
 		  mycolorrampred(5))
 	  plot(bilesp,plot.type="barplot",color=color,silent=TRUE)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	  })
 
 test_that("test that summary method works",{
@@ -92,5 +95,6 @@
 	  bilesp<-connect(bilesp,silent=TRUE)
 	  bilesp<-calcule(bilesp,silent=TRUE)
 	  summary(bilesp,silent=TRUE)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 



More information about the Stacomir-commits mailing list