kamaraju kusumanchi
2015-Apr-19 21:58 UTC
[R-sig-Debian] running unit tests on the stringr package
I am trying to learn how to run the unit tests in the stringr package and have the following questions. 1) The r-cran-stringr package does not suggest/depend on the r-cran-testthat package . Would it make sense to add such a thing since after all the tests in /usr/lib/R/site-library/stringr/tests rely on testthat package? 2) I am getting the following error when trying to run the unit tests % R R version 3.1.1 (2014-07-10) -- "Sock it to Me" ...> library('testthat') > library('stringr') > test_dir('/usr/lib/R/site-library/stringr/tests')String and pattern checks : 123 Counting matches : .... Detecting patterns : .......... Duplicating strings : ...... Extract patterns : .. Joining strings : ...... String length : ......... Locations : ............ Matching groups : .............. Test padding : .... Splitting strings : ......................... Extracting substrings : ................... Trimming strings : ........ 1. Failure(@test-check.r#4): string is atomic ---------------------------------- check_string(list()) does not match 'must be an atomic'. Actual value: "Error in force(expr) : could not find function "check_string"\n" 2. Failure(@test-check.r#9): pattern is a string ------------------------------- check_pattern(1) does not match 'must be a character vector'. Actual value: "Error in force(expr) : could not find function "check_pattern"\n" 3. Error: error when string and pattern lengths incompatible ------------------- could not find function "check_pattern" 1: withCallingHandlers(eval(code, new_test_environment), error = capture_calls) 2: eval(code, new_test_environment) 3: eval(expr, envir, enclos) 4: expect_that(check_pattern(letters, "a"), equals(letters)) at test-check.r:14 5: condition(object) 6: compare(expected, actual, ...) 7: compare.character(expected, actual, ...) 8: identical(x, y) What am I doing wrong? I am using a Debian box with a combo of Wheezy + Jessie % dpkg -l r-cran-testthat r-cran-stringr r-base ii r-base 3.1.1-1 all GNU R statistical computation and graphics system ii r-cran-stringr 0.6.2-2 all Make it easier to work with strings ii r-cran-testthat 0.9.1-1 amd64 GNU R testsuite regards raju -- Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog
Dirk Eddelbuettel
2015-Apr-19 22:35 UTC
[R-sig-Debian] running unit tests on the stringr package
On 19 April 2015 at 17:58, kamaraju kusumanchi wrote: | I am trying to learn how to run the unit tests in the stringr package | and have the following questions. Wrong list. Please ask the maintainer of the package, or r-help. This has next to nothing to do with using R on Debian/Ubuntu. Please do not abuse the genorisity of the readers of this list. Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
kamaraju kusumanchi
2015-Apr-19 22:57 UTC
[R-sig-Debian] running unit tests on the stringr package
On Sun, Apr 19, 2015 at 6:35 PM, Dirk Eddelbuettel <edd at debian.org> wrote:> > On 19 April 2015 at 17:58, kamaraju kusumanchi wrote: > | I am trying to learn how to run the unit tests in the stringr package > | and have the following questions. > > Wrong list. Please ask the maintainer of the package, or r-help. > > This has next to nothing to do with using R on Debian/Ubuntu. Please do not > abuse the genorisity of the readers of this list. > > DirkHi Dirk, My intention was not to abuse anyone's time. I am not sure why you thought otherwise. I think my first point of adding r-cran-testthat to depends/suggests field is relevant to packaging, no? Regarding the second point, I asked the question here because I installed the package from debian repositories and not directly from the upstream. In particular, I was not sure if the problem is debian specific or upstream specific. So, I thought I would start here. raju -- Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog
Johannes Ranke
2015-Apr-20 09:36 UTC
[R-sig-Debian] running unit tests on the stringr package
Dear Raju I agree to Dirk that this is not really the best place for these matters, but as I got curious, I checked and found you should use test_package() and not test_dir(), as the latter does not load unexported functions of the package (such as check_string()) that may occur in the tests. For packaging of r-cran-stringr, it is probably most efficient to file a bug report there because of the missing Suggests for r-cran-testthat. Kind regards, Johannes Am Sonntag, 19. April 2015, 17:58:53 schrieb kamaraju kusumanchi:> I am trying to learn how to run the unit tests in the stringr package > and have the following questions. > > 1) The r-cran-stringr package does not suggest/depend on the > r-cran-testthat package . Would it make sense to add such a thing > since after all the tests in /usr/lib/R/site-library/stringr/tests > rely on testthat package? > > 2) I am getting the following error when trying to run the unit tests > > % R > R version 3.1.1 (2014-07-10) -- "Sock it to Me" > ... > > > library('testthat') > > library('stringr') > > test_dir('/usr/lib/R/site-library/stringr/tests') > > String and pattern checks : 123 > Counting matches : .... > Detecting patterns : .......... > Duplicating strings : ...... > Extract patterns : .. > Joining strings : ...... > String length : ......... > Locations : ............ > Matching groups : .............. > Test padding : .... > Splitting strings : ......................... > Extracting substrings : ................... > Trimming strings : ........ > > > 1. Failure(@test-check.r#4): string is atomic > ---------------------------------- check_string(list()) does not match > 'must be an atomic'. Actual value: "Error in force(expr) : could not find > function "check_string"\n" > > 2. Failure(@test-check.r#9): pattern is a string > ------------------------------- check_pattern(1) does not match 'must be a > character vector'. Actual value: "Error in force(expr) : could not find > function > "check_pattern"\n" > > 3. Error: error when string and pattern lengths incompatible > ------------------- could not find function "check_pattern" > 1: withCallingHandlers(eval(code, new_test_environment), error > capture_calls) 2: eval(code, new_test_environment) > 3: eval(expr, envir, enclos) > 4: expect_that(check_pattern(letters, "a"), equals(letters)) at > test-check.r:14 5: condition(object) > 6: compare(expected, actual, ...) > 7: compare.character(expected, actual, ...) > 8: identical(x, y) > > What am I doing wrong? > > I am using a Debian box with a combo of Wheezy + Jessie > > % dpkg -l r-cran-testthat r-cran-stringr r-base > ii r-base 3.1.1-1 all > GNU R statistical computation and graphics system > ii r-cran-stringr 0.6.2-2 all > Make it easier to work with strings > ii r-cran-testthat 0.9.1-1 amd64 > GNU R testsuite > > regards > raju-- PD Dr. Johannes Ranke Kronacher Str. 8 79639 Grenzach-Wyhlen
kamaraju kusumanchi
2015-Apr-23 01:46 UTC
[R-sig-Debian] running unit tests on the stringr package
On Mon, Apr 20, 2015 at 5:36 AM, Johannes Ranke <jranke at uni-bremen.de> wrote:> Dear Raju > > I agree to Dirk that this is not really the best place for these matters, but > as I got curious, I checked and found you should use test_package() and not > test_dir(), as the latter does not load unexported functions of the package > (such as check_string()) that may occur in the tests. > > For packaging of r-cran-stringr, it is probably most efficient to file a bug > report there because of the missing Suggests for r-cran-testthat. > > Kind regards, > > JohannesThanks Johannes. I will check out your suggestions. raju