[Stacomir-commits] r530 - in pkg/stacomir/tests: . testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Oct 1 17:19:58 CEST 2018


Author: legrand
Date: 2018-10-01 17:19:57 +0200 (Mon, 01 Oct 2018)
New Revision: 530

Modified:
   pkg/stacomir/tests/testthat.R
   pkg/stacomir/tests/testthat/test-00-stacomir.R
   pkg/stacomir/tests/testthat/test-00-zrefclasses.R
   pkg/stacomir/tests/testthat/test-01-report_mig_mult.R
   pkg/stacomir/tests/testthat/test-02-report_mig.R
   pkg/stacomir/tests/testthat/test-03-report_df.R
   pkg/stacomir/tests/testthat/test-04-report_dc.R
   pkg/stacomir/tests/testthat/test-05-report_sample_char.R
   pkg/stacomir/tests/testthat/test-06-report_mig_interannual.R
   pkg/stacomir/tests/testthat/test-07-report_sea_age.R
   pkg/stacomir/tests/testthat/test-08-report_silver_eel.R
   pkg/stacomir/tests/testthat/test-09-report_annual.R
   pkg/stacomir/tests/testthat/test-10-report_env.R
   pkg/stacomir/tests/testthat/test-11-report_mig_env.R
   pkg/stacomir/tests/testthat/test-12-report_mig_char.R
   pkg/stacomir/tests/testthat/test-13-report_species.R
Log:


Modified: pkg/stacomir/tests/testthat/test-00-stacomir.R
===================================================================
--- pkg/stacomir/tests/testthat/test-00-stacomir.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-00-stacomir.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,7 +1,7 @@
 context("stacomi base connection")
 
 test_that("Test existence of csv file",{
-	  skip_on_cran()
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  filecsv<-"C:/Program Files/stacomi/calcmig.csv";
 	  expect_equivalent(file.access(filecsv,0),0)
 	}
@@ -11,7 +11,7 @@
 #the program will set time to GMT, this will cause some errors hard to understand in some of 
 # the classes (report_mig, report_mig_mult), with the following you can check this problem
 test_that("Test that the program is running under the right locale",{
-	  skip_on_cran()
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  expect_equal(Sys.getlocale(category = "LC_TIME"),"French_France.1252")			
 	}
 )
@@ -25,7 +25,7 @@
 )
 
 test_that("Test that ODBC link exists and has the right length",{
-	  require(stacomiR)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  result<-chargecsv(database_expected=TRUE);
 	  expect_equal(length(result),4)
 	  expect_equal(length(result$baseODBC),3)
@@ -36,8 +36,7 @@
 context("Database connection")
 
 test_that("Test that stacomirtools connects",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
       envir_stacomi <- new.env(parent = asNamespace("stacomiR"))
 	  mylinks=chargecsv(database_expected=TRUE)
 	  baseODBC=mylinks[["baseODBC"]]	
@@ -52,8 +51,7 @@
 
 
 test_that("Test that positive count for nrow(ref.tr_taxon_tax)",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
       envir_stacomi <- new.env(parent = asNamespace("stacomiR"))
 	  mylinks=chargecsv(database_expected=TRUE)
 	  baseODBC=mylinks[["baseODBC"]]	
@@ -67,8 +65,7 @@
 	})
 
 test_that("Tests positive count for sch.t_operation_ope",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
       envir_stacomi <- new.env(parent = asNamespace("stacomiR"))
 	  mylinks=chargecsv(database_expected=TRUE)
 	  baseODBC=mylinks[["baseODBC"]]	
@@ -86,32 +83,28 @@
 
 
 test_that("Test that working environment is created",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=TRUE,login_window=TRUE,database_expected=TRUE)
 	  expect_true(exists("envir_stacomi"))
 	  dispose(get("logw",envir_stacomi))
 	})
 
 test_that("Test that gWidget loginwindow is loaded ",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=TRUE,login_window=TRUE,database_expected=TRUE)
 	  expect_true(exists("logw",envir_stacomi))
 	  dispose(get("logw",envir_stacomi))
 	})
 
 test_that("Test that gWidget gr_interface is loaded, without database_expected, nor login window",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=TRUE,login_window=FALSE,database_expected=FALSE)
 	  expect_true(exists("win",envir_stacomi))			
 	  dispose(get("win",envir_stacomi))
 	})
 
 test_that("gWidget gr_interface is loaded, with pre launch_test, but without login window",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=TRUE,login_window=FALSE,database_expected=TRUE)
 	  expect_true(exists("win",envir_stacomi))
 	  dispose(get("win",envir_stacomi))
@@ -124,7 +117,7 @@
 
 test_that("Test that tickets have been launched",
 	{
-	  skip_on_cran()
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  require(stacomiR)
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  req<-new("RequeteODBC")
@@ -153,7 +146,7 @@
 				  "ajout de la notion de cohorte pour les saumons passant très précocément", 
 				  "Mise à jour des localisations anatomiques", 
 				  "Mise à jour vers la version 0.4 alpha, mise à jour des référentiels du SANDRE, script ticjet81_mise_en_conformite_sandre, révision 98", 
-				  "Mise à jour vers la version 0.4 alpha, mise à jour ds constraintes stationmesure modification limites coordonnées géographiques", 
+				  "Mise à jour vers la version 0.4 alpha, mise à jour des constraintes stationmesure modification limites coordonnées géographiques", 
 				  "Mise à jour vers la version 0.4 alpha, problèmes de clé étrangères, script total", 
 				  "Mise à jour vers la version 0.4 alpha, creation des masques"
 			  )), 
@@ -169,9 +162,8 @@
 # test on current schema
 test_that("All foreign keys are present",
 	{
-	  skip_on_cran()
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  req<-new("RequeteODBC")
 	  baseODBC<-get("baseODBC", envir=envir_stacomi)
 	  options(warn=-1)
@@ -193,7 +185,7 @@
 				  "c_fk_act_mqe_reference", "c_fk_act_org_code", "c_fk_bjo_org_code", 
 				  "c_fk_bjo_std_code", "c_fk_bjo_tax_code", "c_fk_bme_std_code", 
 				  "c_fk_bme_tax_code", "c_fk_car_lot_identifiant", "c_fk_car_org_code", 
-				  "c_fk_car_par_code", "c_fk_car_val_identifiant", "c_fk_coe_org_code", 
+				  "c_fk_car_par_code", "c_fk_car_val_par_identifiant", "c_fk_coe_org_code", 
 				  "c_fk_coe_qte_code", "c_fk_coe_std_code", "c_fk_coe_tax_code", 
 				  "c_fk_dft_df_identifiant", "c_fk_dft_org_code", "c_fk_dft_tdf_code", 
 				  "c_fk_dic_dif_identifiant", "c_fk_dic_dis_identifiant", "c_fk_dic_org_code", 

Modified: pkg/stacomir/tests/testthat/test-00-zrefclasses.R
===================================================================
--- pkg/stacomir/tests/testthat/test-00-zrefclasses.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-00-zrefclasses.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,7 +1,6 @@
 context("ref_horodate")
 test_that("Test that the parsing of many kind of dates works",
 	{
-	  require(stacomiR)
 	  ref_horodate<-new("ref_horodate")
 	  # regular expression to test string "1] nous avons le choix dans la date\n"
 	  # default string returned by the method
@@ -23,7 +22,6 @@
 
 test_that("Test that the parsing of wrong character formats gets an error",
 	{
-	  require(stacomiR)
 	  ref_horodate<-new("ref_horodate")
 	  options(warn = -1)
 	  expect_error(ref_horodate<-choice_c(ref_horodate,	
@@ -36,8 +34,7 @@
 
 test_that("Test that ref_df choice_c method loads character, numeric, but not rubbish",
 	{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  ref_df<-new("ref_df")
 	  ref_df<-charge(ref_df)

Modified: pkg/stacomir/tests/testthat/test-01-report_mig_mult.R
===================================================================
--- pkg/stacomir/tests/testthat/test-01-report_mig_mult.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-01-report_mig_mult.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,6 +1,6 @@
 context("report_mig_mult")
 test_that("Test an instance of report_mig_mult",{
-	  require(stacomiR)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  report_mig_mult<-new("report_mig_mult")
 	  #options(warn = -1)
@@ -19,7 +19,7 @@
 
 ## This test check that the code above works with numeric and a different formating for date
 test_that("Test another instance of report_mig_mult",{
-	  require(stacomiR)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  report_mig_mult<-new("report_mig_mult")
 	  #options(warn = -1)
@@ -37,7 +37,7 @@
 	})
 test_that("Tests one instance with error (dc does not exist)",
 	{
-	  require(stacomiR)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  report_mig_mult<-new("report_mig_mult")
 	  options(warn = -1)
@@ -54,7 +54,7 @@
 
 test_that("Test charge method for report_mig_mult",
 	{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  report_mig_mult<-new("report_mig_mult")
 	  options(warn = -1)
@@ -75,7 +75,7 @@
 
 test_that("Test connect method for report_mig_mult",
 	{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  report_mig_mult<-new("report_mig_mult")
 	  options(warn = -1)
@@ -99,18 +99,18 @@
 	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
 
-test_that("Test example 01_report_mig_mult",
-	{
-	  skip_on_cran()
-	  # check if built with examples (Rtools install --example
-	  example_path<-file.path(.libPaths()[1],"stacomiR","R-ex","report_mig_mult-class.R")
-	  test<-file.access(example_path,0)
-	  if (test[1]!=0) warnings("Package example dir not created ?") else
-		options(warn = -1)
-	  source(example_path)
-	  options(warn = 0)
-	  expect_output(summary(r_mig_mult,silent=FALSE))      
-      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
-	})
+#test_that("Test example 01_report_mig_mult",
+#	{
+#	  #skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+#	  # check if built with examples (Rtools install --example
+#	  example_path<-file.path(.libPaths()[1],"stacomiR","R-ex","report_mig_mult-class.R")
+#	  test<-file.access(example_path,0)
+#	  if (test[1]!=0) warnings("Package example dir not created ?") else
+#		options(warn = -1)
+#	  source(example_path)
+#	  options(warn = 0)
+#	  expect_output(summary(r_mig_mult,silent=FALSE))      
+#      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
+#	})
 
 

Modified: pkg/stacomir/tests/testthat/test-02-report_mig.R
===================================================================
--- pkg/stacomir/tests/testthat/test-02-report_mig.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-02-report_mig.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,7 +1,7 @@
 context("report_mig")
 test_that("Test an instance of report_mig",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  baseODBC[c(2,3)]<-rep("iav",2)
@@ -24,8 +24,7 @@
 
 
 test_that("Test an instance of report_mig, check that operations accross two years are split correcly",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  baseODBC[c(2,3)]<-rep("iav",2)
@@ -54,8 +53,8 @@
 	})
 
 test_that("Test another instance of report_mig, check that operations accross two years are split correcly",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  baseODBC[c(2,3)]<-rep("iav",2)
@@ -84,9 +83,10 @@
 	})
 
 test_that("Test connect method",{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
-		  database_expected=FALSE)	
+		  database_expected=TRUE)	
 	  # overriding user schema
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  baseODBC[c(2,3)]<-rep("iav",2)
@@ -122,6 +122,7 @@
 
 test_that("Summary method works",
 	{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=TRUE)	
@@ -140,6 +141,7 @@
 
 test_that("Test writing an example to the database",
 	{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=TRUE)	
@@ -158,6 +160,7 @@
 
 test_that("Test that different sums are the same, for report_mig, report_mig_interannual, report_annual",
 	{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=TRUE)	
@@ -201,14 +204,8 @@
 	{
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
-		  database_expected=TRUE)	
+		  database_expected=FALSE)	
 	  # overriding user schema
-	  baseODBC<-get("baseODBC",envir=envir_stacomi)
-	  baseODBC[c(2,3)]<-rep("iav",2)
-	  assign("baseODBC",baseODBC,envir_stacomi)
-	  sch<-get("sch",envir=envir_stacomi) # "iav."
-	  assign("sch","iav.",envir_stacomi)
-	  # this chunk is not launched from examples but loads the r_mig dataset if connection works	
 	  data("r_mig")
 	  expect_output(print(r_mig), "report_mig=choice_c",info = NULL)
 	  rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
@@ -218,6 +215,7 @@
 
 test_that("test example for fd80",
 	{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=TRUE)	
@@ -246,6 +244,7 @@
 
 test_that("test example with glass eel",
 	{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=TRUE)	

Modified: pkg/stacomir/tests/testthat/test-03-report_df.R
===================================================================
--- pkg/stacomir/tests/testthat/test-03-report_df.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-03-report_df.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,7 +1,7 @@
 context("report_df")
 
 test_that("Test an instance of report_df",{
-	  require(stacomiR)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -30,7 +30,7 @@
 	})
 
 test_that("report_df charge method works",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -53,7 +53,6 @@
 
 
 test_that("report_df plot method works",{
-	  require(stacomiR)
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  data(r_df)
 	  r_df<-r_df
@@ -66,7 +65,6 @@
 
 
 test_that("report_df summary method works",{
-	  require(stacomiR)
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  data(r_df)
 	  r_df<-r_df
@@ -76,7 +74,6 @@
 
 
 test_that("report_df print method works",{
-	  require(stacomiR)
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  data(r_df)
 	  r_df<-r_df

Modified: pkg/stacomir/tests/testthat/test-04-report_dc.R
===================================================================
--- pkg/stacomir/tests/testthat/test-04-report_dc.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-04-report_dc.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,15 +1,14 @@
 context("report_dc")
 
 test_that("Test an instance of report_dc",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  baseODBC[c(2,3)]<-rep("iav",2)
 	  assign("baseODBC",baseODBC,envir_stacomi)
 	  sch<-get("sch",envir=envir_stacomi) # "iav."
-	  assign("sch","iav.",envir_stacomi)
-	  
+	  assign("sch","iav.",envir_stacomi)	  
 	  r_dc<-new("report_dc")
 	  r_dc<-choice_c(r_dc,
 		  5,
@@ -31,7 +30,7 @@
 	})
 
 test_that("report_dc charge method works",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -54,7 +53,6 @@
 
 
 test_that("report_dc plot method works",{
-	  require(stacomiR)
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  data(r_dc)
 	  r_dc<-r_dc
@@ -67,7 +65,6 @@
 
 
 test_that("report_dc summary method works",{
-	  require(stacomiR)
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  data(r_dc)
 	  r_dc<-r_dc

Modified: pkg/stacomir/tests/testthat/test-05-report_sample_char.R
===================================================================
--- pkg/stacomir/tests/testthat/test-05-report_sample_char.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-05-report_sample_char.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -1,8 +1,7 @@
 context("report_sample_char")
 
 test_that("Test that view lot_ope_car exists",{
-	  skip_on_cran()
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  req<-new("RequeteODBC")
 	  req at baseODBC<-get("baseODBC", envir=envir_stacomi)		
@@ -15,7 +14,7 @@
 	})
 
 test_that("Test an instance of report_sample_char loaded with choice_c",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -43,7 +42,7 @@
 
 
 test_that("Test methods in report_sample_char",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -72,7 +71,7 @@
 	})
 
 test_that("Test charge method for report_sample_char",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)

Modified: pkg/stacomir/tests/testthat/test-06-report_mig_interannual.R
===================================================================
--- pkg/stacomir/tests/testthat/test-06-report_mig_interannual.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-06-report_mig_interannual.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,7 +2,7 @@
 
 
 test_that("Test an instance of report_mig_interannual loaded with choice_c",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -31,7 +31,7 @@
 
 
 test_that("Test method summary in report_mig_interannual",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -72,7 +72,7 @@
 
 test_that("Test that loading two taxa will fail",
 	{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -100,7 +100,7 @@
 
 test_that("Test that report_mig_interannual loads missing data with correct warning",
 	{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -127,6 +127,7 @@
 
 test_that("Test that different sums are the same, for  report_mig_interannual, report_mig_mult",
 	{
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=TRUE)	
@@ -183,30 +184,30 @@
 	  )		
       rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
 	})
-    
-    test_that("Test bmi step plot",{
-	            require(stacomiR)
-	            stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
-	            # overriding user schema to point to iav
-	            baseODBC<-get("baseODBC",envir=envir_stacomi)
-	            baseODBC[c(2,3)]<-rep("iav",2)
-	            assign("baseODBC",baseODBC,envir_stacomi)
-	            sch<-get("sch",envir=envir_stacomi) # "iav."
-	            assign("sch","iav.",envir_stacomi)
-	            r_mig_interannual<-new("report_mig_interannual")
-	            # the following will load data for size, 
-	            # parameters 1786 (total size) C001 (size at video control)
-	            # dc 5 and 6 are fishways located on the Arzal dam
-	            # two stages are selected
-	            r_mig_interannual<-choice_c(r_mig_interannual,
-		                dc=6,
-		                taxa=c("Anguilla anguilla"),
-		                stage=c("AGJ"),
-		                anneedebut=1996,
-		                anneefin=2015,
-		                silent=TRUE)
-	            r_mig_interannual<-connect(r_mig_interannual,silent=TRUE)	
-	            plot(r_mig_interannual,plot.type="step",silent=TRUE)
-                rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
-	        })
-              
+
+test_that("Test bmi step plot",{
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
+	  # overriding user schema to point to iav
+	  baseODBC<-get("baseODBC",envir=envir_stacomi)
+	  baseODBC[c(2,3)]<-rep("iav",2)
+	  assign("baseODBC",baseODBC,envir_stacomi)
+	  sch<-get("sch",envir=envir_stacomi) # "iav."
+	  assign("sch","iav.",envir_stacomi)
+	  r_mig_interannual<-new("report_mig_interannual")
+	  # the following will load data for size, 
+	  # parameters 1786 (total size) C001 (size at video control)
+	  # dc 5 and 6 are fishways located on the Arzal dam
+	  # two stages are selected
+	  r_mig_interannual<-choice_c(r_mig_interannual,
+		  dc=6,
+		  taxa=c("Anguilla anguilla"),
+		  stage=c("AGJ"),
+		  anneedebut=1996,
+		  anneefin=2015,
+		  silent=TRUE)
+	  r_mig_interannual<-connect(r_mig_interannual,silent=TRUE)	
+	  plot(r_mig_interannual,plot.type="step",silent=TRUE)
+      rm(list=ls(envir=envir_stacomi),envir=envir_stacomi)
+	})
+

Modified: pkg/stacomir/tests/testthat/test-07-report_sea_age.R
===================================================================
--- pkg/stacomir/tests/testthat/test-07-report_sea_age.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-07-report_sea_age.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,7 +2,7 @@
 
 
 test_that("test creating an instance of report_sea_age with data loaded (logrami required)",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  r_seaa<-new("report_sea_age")
@@ -25,7 +25,7 @@
 	})
 
 test_that("test that loading bad limits fails",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  # overriding user schema to point to iav
 	  r_seaa<-new("report_sea_age")

Modified: pkg/stacomir/tests/testthat/test-08-report_silver_eel.R
===================================================================
--- pkg/stacomir/tests/testthat/test-08-report_silver_eel.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-08-report_silver_eel.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,7 +2,7 @@
 
 
 test_that("test creating an instance of report_silver_eel with data loaded (fd80 schema required)",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
         r_silver<-new("report_silver_eel")

Modified: pkg/stacomir/tests/testthat/test-09-report_annual.R
===================================================================
--- pkg/stacomir/tests/testthat/test-09-report_annual.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-09-report_annual.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,7 +2,7 @@
 
 
 test_that("Test an instance of report_annual loaded with choice_c",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -25,7 +25,7 @@
 
 
 test_that("Test methods in report_annual",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
@@ -64,7 +64,7 @@
 
 test_that("Complement to example",
     {
-      require(stacomiR)
+      skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  data(r_ann)
       xtr_ann<-stacomiR::xtable(r_ann,
@@ -115,11 +115,11 @@
     })
 
 test_that("test xtable method for report_annual",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 # launching stacomi without selecting the scheme or interface
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
-		  database_expected=FALSE)
+		  database_expected=TRUE)
 	  baseODBC<-get("baseODBC",envir=envir_stacomi)
 	  baseODBC[c(2,3)]<-rep("iav",2)
 	  assign("baseODBC",baseODBC,envir_stacomi)

Modified: pkg/stacomir/tests/testthat/test-10-report_env.R
===================================================================
--- pkg/stacomir/tests/testthat/test-10-report_env.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-10-report_env.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,8 +2,8 @@
 
 
 test_that("test creating an instance of report_env",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  r_env<-new("report_env")
 	  r_env<-choice_c(r_env,
 		  stationMesure=c("temp_gabion","coef_maree"),
@@ -16,8 +16,8 @@
 	})
 
 test_that("test plot method",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  r_env<-new("report_env")
 	  r_env<-choice_c(r_env,
 		  stationMesure=c("temp_gabion","coef_maree"),

Modified: pkg/stacomir/tests/testthat/test-11-report_mig_env.R
===================================================================
--- pkg/stacomir/tests/testthat/test-11-report_mig_env.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-11-report_mig_env.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,8 +2,8 @@
 
 
 test_that("test creating an instance of report_mig_env",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  r_mig_env<-new("report_mig_env")
 	  r_mig_env<-choice_c(r_mig_env,
 		  dc=c(5,6,12),
@@ -21,8 +21,8 @@
 	})
 
 test_that("test plot method",{
-	  require(stacomiR)
-	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
+	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=FALSE)
 	  r_mig_env<-new("report_mig_env")
 	  r_mig_env<-choice_c(r_mig_env,
 		  dc=c(5,6,12),

Modified: pkg/stacomir/tests/testthat/test-12-report_mig_char.R
===================================================================
--- pkg/stacomir/tests/testthat/test-12-report_mig_char.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-12-report_mig_char.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -2,7 +2,7 @@
 
 
 test_that("test creating an instance of report_mig_char and connect method (logrami required)",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to logrami
 	  assign("sch","logrami.",envir_stacomi)
@@ -31,7 +31,7 @@
 	})
 
 test_that("test setasqualitative method",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  assign("sch","logrami.",envir_stacomi)
@@ -69,7 +69,7 @@
 
 
 test_that("test calcule method",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,login_window=FALSE,database_expected=TRUE)
 	  # overriding user schema to point to iav
 	  assign("sch","logrami.",envir_stacomi)

Modified: pkg/stacomir/tests/testthat/test-13-report_species.R
===================================================================
--- pkg/stacomir/tests/testthat/test-13-report_species.R	2018-10-01 15:15:31 UTC (rev 529)
+++ pkg/stacomir/tests/testthat/test-13-report_species.R	2018-10-01 15:19:57 UTC (rev 530)
@@ -3,7 +3,7 @@
 
 test_that("test creating an instance of report_species",{
 	  
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=FALSE)
@@ -26,7 +26,7 @@
 
 test_that("test calcule method report_species",{
 	  
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=FALSE)
@@ -47,7 +47,7 @@
 	})
 
 test_that("test that plot method works",{
-	  require(stacomiR)
+	  skip_if_not(stacomi_installed(),"skipping as the program is not installed on this computer")
 	  stacomi(gr_interface=FALSE,
 		  login_window=FALSE,
 		  database_expected=FALSE)
@@ -78,7 +78,7 @@
 	  })
 
 test_that("test that summary method works",{
-	  require(stacomiR)
[TRUNCATED]

To get the complete diff run:
    svnlook diff /svnroot/stacomir -r 530


More information about the Stacomir-commits mailing list