Split tests into multiple testthat files (#11)

* test filtering in test_check

* change to multiple testthat files
This commit is contained in:
Jonathan Zhu 2018-11-06 12:36:55 -08:00 коммит произвёл GitHub
Родитель 90a019a936
Коммит 19e91e1dc7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
15 изменённых файлов: 154 добавлений и 12 удалений

Просмотреть файл

@ -8,12 +8,12 @@ Depends:
R (>= 3.2.2)
Imports:
RODBC, RODBCext, tools, methods, utils
Description: Provides a set of functions allowing the user
to wrap their R script into a TSQL stored procedure, register
that stored procedure with a database, and test it from an R
development environment.
Description: sqlmlutils is a package designed to help users interact with SQL Server and execute R or Python code
from an R/Python client. It provides a series of functions for executing functions in SQL,
creating and running stored procedures, and managing packages on the database.
License: MIT + file LICENSE
Copyright: Copyright 2016 Microsoft Corporation
RoxygenNote: 6.1.0
Encoding: UTF-8
Suggests: testthat,
roxygen2

37
R/R/sqlmlutils.R Normal file
Просмотреть файл

@ -0,0 +1,37 @@
#' @section Executing in SQL:
#'
#' \itemize{
#' \item \code{\link{connectionInfo}}: Creates a connection string from a set of parameters
#'
#' \item \code{\link{executeScriptInSQL}}: Executes a script file inside SQL
#'
#' \item \code{\link{executeFunctionInSQL}}: Executes a user function inside SQL
#'
#' \item \code{\link{executeSQLQuery}}: Executes a SQL query and returns the resultant table
#' }
#'
#' @section Stored Procedures:
#' \itemize{
#' \item \code{\link{createSprocFromFunction}}: Creates a stored procedure from a custom R function
#'
#' \item \code{\link{createSprocFromScript}}: Creates a stored procedure from a custom R script file
#'
#' \item \code{\link{dropSproc}}: Drops a stored procedure from the database
#'
#' \item \code{\link{executeSproc}}: Executes a stored procedure that is already in the database
#'
#' \item \code{\link{checkSproc}}: Checks if a stored procedure is already in the database
#' }
#'
#' @section Package Management:
#'
#' \itemize{
#' \item \code{\link{sql_install.packages}}: Installs packages on a SQL Server
#'
#' \item \code{\link{sql_remove.packages}}: Removes packages from a SQL Server
#'
#' \item \code{\link{sql_installed.packages}}: Enumerates the installed packages on a SQL Server
#' }
#' @keywords package
"_PACKAGE"
#> [1] "_PACKAGE"

Просмотреть файл

@ -6,6 +6,7 @@ sqlmlutils is an R package to help execute R code on a SQL Server machine.
Run
```
R -e "install.packages('RODBCext', repos='https://cran.microsoft.com')"
R CMD INSTALL dist/sqlmlutils_0.5.0.zip
```
OR

Просмотреть файл

@ -1,6 +1,6 @@
pushd .
cd ..
R -e "install.packages('RODBCext', repos='https://cran.rstudio.com')"
R -e "install.packages('RODBCext', repos='https://cran.microsoft.com')"
R CMD INSTALL --build R
mv sqlmlutils_0.5.0.zip R/dist
popd

Двоичные данные
R/dist/sqlmlutils_0.5.0.zip поставляемый

Двоичный файл не отображается.

Просмотреть файл

@ -0,0 +1,54 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/sqlmlutils.R
\docType{package}
\name{sqlmlutils-package}
\alias{sqlmlutils}
\alias{sqlmlutils-package}
\title{sqlmlutils: Wraps R code into executable SQL Server stored procedures}
\description{
sqlmlutils is a package designed to help users interact with SQL Server and execute R or Python code
from an R/Python client. It provides a series of functions for executing functions in SQL,
creating and running stored procedures, and managing packages on the database.
}
\section{Executing in SQL}{
\itemize{
\item \code{\link{connectionInfo}}: Creates a connection string from a set of parameters
\item \code{\link{executeScriptInSQL}}: Executes a script file inside SQL
\item \code{\link{executeFunctionInSQL}}: Executes a user function inside SQL
\item \code{\link{executeSQLQuery}}: Executes a SQL query and returns the resultant table
}
}
\section{Stored Procedures}{
\itemize{
\item \code{\link{createSprocFromFunction}}: Creates a stored procedure from a custom R function
\item \code{\link{createSprocFromScript}}: Creates a stored procedure from a custom R script file
\item \code{\link{dropSproc}}: Drops a stored procedure from the database
\item \code{\link{executeSproc}}: Executes a stored procedure that is already in the database
\item \code{\link{checkSproc}}: Checks if a stored procedure is already in the database
}
}
\section{Package Management}{
\itemize{
\item \code{\link{sql_install.packages}}: Installs packages on a SQL Server
\item \code{\link{sql_remove.packages}}: Removes packages from a SQL Server
\item \code{\link{sql_installed.packages}}: Enumerates the installed packages on a SQL Server
}
}
\keyword{package}

7
R/tests/testthat-Sproc.R Normal file
Просмотреть файл

@ -0,0 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "storedProcedure")

Просмотреть файл

@ -0,0 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "execute")

Просмотреть файл

@ -1,7 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils")
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "basic")

Просмотреть файл

@ -0,0 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "dependencies")

Просмотреть файл

@ -0,0 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "createExternal")

Просмотреть файл

@ -0,0 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "scope")

Просмотреть файл

@ -0,0 +1,7 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "toplevel")

Просмотреть файл

@ -0,0 +1,8 @@
# Copyright(c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT license.
library(testthat)
library(sqlmlutils)
test_check("sqlmlutils", filter = "unit")