[Stacomir-commits] r509 - in pkg/stacomirtools: . R inst inst/config tests tests/testthat

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Sep 23 14:25:20 CEST 2018


Author: briand
Date: 2018-09-23 14:25:19 +0200 (Sun, 23 Sep 2018)
New Revision: 509

Added:
   pkg/stacomirtools/.Rbuildignore
   pkg/stacomirtools/.Rinstignore
   pkg/stacomirtools/NEWS.md
   pkg/stacomirtools/inst/
   pkg/stacomirtools/inst/config/
   pkg/stacomirtools/inst/config/test.R
   pkg/stacomirtools/tests/
   pkg/stacomirtools/tests/testthat.R
   pkg/stacomirtools/tests/testthat/
   pkg/stacomirtools/tests/testthat/test-00.R
Modified:
   pkg/stacomirtools/DESCRIPTION
   pkg/stacomirtools/R/RequeteODBC.r
Log:
Develop unit tests for stacomirtools

Added: pkg/stacomirtools/.Rbuildignore
===================================================================
--- pkg/stacomirtools/.Rbuildignore	                        (rev 0)
+++ pkg/stacomirtools/.Rbuildignore	2018-09-23 12:25:19 UTC (rev 509)
@@ -0,0 +1,2 @@
+^NEWS.md$
+^NEWS.md.html$
\ No newline at end of file

Added: pkg/stacomirtools/.Rinstignore
===================================================================
--- pkg/stacomirtools/.Rinstignore	                        (rev 0)
+++ pkg/stacomirtools/.Rinstignore	2018-09-23 12:25:19 UTC (rev 509)
@@ -0,0 +1 @@
+inst/config/test.R
\ No newline at end of file

Modified: pkg/stacomirtools/DESCRIPTION
===================================================================
--- pkg/stacomirtools/DESCRIPTION	2018-09-22 12:18:53 UTC (rev 508)
+++ pkg/stacomirtools/DESCRIPTION	2018-09-23 12:25:19 UTC (rev 509)
@@ -1,11 +1,11 @@
 Package: stacomirtools
-Version: 0.5.2
-Date: 2018-01-04
+Version: 0.5.2.1
+Date: 2018-01-09
 Title: 'ODBC' Connection Class for Package stacomiR
 Authors at R: c(person("Cedric", "Briand", role = c("aut", "cre"), email = "cedric.briand00 at gmail.com"))
 Author: Cedric Briand [aut, cre]
 Maintainer: Cedric Briand <cedric.briand00 at gmail.com>
-Description:S4 class wrappers for the 'ODBC' connection, also provides some 
+Description: S4 class wrappers for the 'ODBC' connection, also provides some 
     utilities to paste small datasets to clipboard, rename columns. It is used by the package 'stacomiR' for
     connections to the database. Development versions of 'stacomiR' are available in R-forge.
 License: GPL (>= 2)
@@ -18,5 +18,6 @@
     'stacomirtools.r'
     'stacomirtools-package.R' 
 LazyLoad: yes
-Depends:RODBC
-Imports: methods,xtable,utils
\ No newline at end of file
+Depends: RODBC
+Imports: methods,xtable,utils
+Suggests: testthat

Added: pkg/stacomirtools/NEWS.md
===================================================================
--- pkg/stacomirtools/NEWS.md	                        (rev 0)
+++ pkg/stacomirtools/NEWS.md	2018-09-23 12:25:19 UTC (rev 509)
@@ -0,0 +1,7 @@
+# stacomitools 0.5.2.5000
+
+
+
+# stacomiR 0.5.2
+
+* previous version of the package
\ No newline at end of file

Modified: pkg/stacomirtools/R/RequeteODBC.r
===================================================================
--- pkg/stacomirtools/R/RequeteODBC.r	2018-09-22 12:18:53 UTC (rev 508)
+++ pkg/stacomirtools/R/RequeteODBC.r	2018-09-23 12:25:19 UTC (rev 509)
@@ -50,7 +50,7 @@
 #'  ## the connection is already closed, the query is printed
 #'}
 setMethod("connect",signature=signature("RequeteODBC"),definition=function(object) {     
-	  msg1<-gettext("'ODBC' error =>you have to define a vector baseODBC with the 'ODBC' link name, user and password")
+      msg1<-gettext("'ODBC' error =>you have to define a vector baseODBC with the 'ODBC' link name, user and password")
 	  msg2<-gettext("connection trial :")
 	  msg3<-gettext("connection impossible")
 	  msg4<-gettext("connection successfull")

Added: pkg/stacomirtools/inst/config/test.R
===================================================================
--- pkg/stacomirtools/inst/config/test.R	                        (rev 0)
+++ pkg/stacomirtools/inst/config/test.R	2018-09-23 12:25:19 UTC (rev 509)
@@ -0,0 +1,5 @@
+# Name : test.R
+setwd("c:/workspace/stacomir/pkg/stacomirtools")
+devtools::test()
+
+

Added: pkg/stacomirtools/tests/testthat/test-00.R
===================================================================
--- pkg/stacomirtools/tests/testthat/test-00.R	                        (rev 0)
+++ pkg/stacomirtools/tests/testthat/test-00.R	2018-09-23 12:25:19 UTC (rev 509)
@@ -0,0 +1,27 @@
+# Name : test-00.R
+context("RequeteODBC")
+
+test_that("Test that RequeteODBC works on a database ", {
+        skip_on_cran()
+        # this requires an odbc link to be setup for test here a database bd_contmig_nat used for stacomir
+        # userlocal and passwordlocal are generated from Rprofile.site
+        require(stacomirtools)
+        req<-new("RequeteODBC")
+        req at sql<-"select * from iav.t_lot_lot limit 10"
+        req at baseODBC <- c("bd_contmig_nat",userlocal,passwordlocal)
+        req<-connect(req)
+        expect_that(req at connection,is_a("RODBC"))
+    })
+
+test_that("Test that RequeteODBC returns the sql string when envir_stacomi and showmerequest ", {
+      skip_on_cran()
+      require(stacomirtools)
+      envir_stacomi <- new.env()
+      assign("showmerequest",1,envir_stacomi)
+      req<-new("RequeteODBC")
+      req at sql<-"select * from iav.t_lot_lot limit 10"
+      req at baseODBC <- c("bd_contmig_nat",userlocal,passwordlocal)
+      req<-connect(req)      
+      expect_that(req at connection,is_a("RODBC"))
+    })
+

Added: pkg/stacomirtools/tests/testthat.R
===================================================================
--- pkg/stacomirtools/tests/testthat.R	                        (rev 0)
+++ pkg/stacomirtools/tests/testthat.R	2018-09-23 12:25:19 UTC (rev 509)
@@ -0,0 +1,4 @@
+library(testthat)
+library(stacomirtools)
+
+test_check("stacomirtools")



More information about the Stacomir-commits mailing list