You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "Dragoș Moldovan-Grünfeld (Jira)" <ji...@apache.org> on 2022/01/12 13:50:00 UTC

[jira] [Comment Edited] (ARROW-15301) [R] Discussion: reorganise the testthat test helpers

    [ https://issues.apache.org/jira/browse/ARROW-15301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17474541#comment-17474541 ] 

Dragoș Moldovan-Grünfeld edited comment on ARROW-15301 at 1/12/22, 1:49 PM:
----------------------------------------------------------------------------

I wouldn't regard moving all {{testthat}} helpers to {{test-helpers.R}} or some file that ends with {_}helpers{_} as a full on reorganisation. 

Why a file ending in {_}helpers{_}? Because {{devtools::load_all()}} sources any files ending in {_}helpers{_} and, thus, any functions defined there are available interactively. In the current scenario if a developer needs to run a test block containing a helper function, they need to find where the helper is defined (source that file or run the lines) and then run the test block. I find this quite cumbersome.


was (Author: dragosmg):
I think a first step could be to move all {{testthat}} helpers to {{test-helpers.R}} or some file that ends with {_}helpers{_}. I wouldn't regard this as a full on reorganisation. 

Why a file ending in {_}helpers{_}? Because {{devtools::load_all()}} sources any files ending in {_}helpers{_} and, thus, any functions defined there are available interactively. In the current scenario if a developer needs to run a test block containing a helper function, they need to find where the helper is defined (source that file or run the lines) and then run the test block. I find this quite cumbersome.

> [R] Discussion: reorganise the testthat test helpers 
> -----------------------------------------------------
>
>                 Key: ARROW-15301
>                 URL: https://issues.apache.org/jira/browse/ARROW-15301
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Dragoș Moldovan-Grünfeld
>            Priority: Major
>             Fix For: 8.0.0
>
>
> Would it make sense to have all custom expectations in {{R/}} , maybe {{R/test-helpers.R}} ? Reasons: 
>  
>  * edit(added on 12/01/2022): probably the most important point is these files are source by {{devtools::load_all()}} and, thus, helper functions are available interactively. 
>  * easier for newbies to read a file and figure out what custom testthat helpers we have
>  * easier to document
>  * respects the testthat author's suggestion to have them there
> Currently we have 17 different custom expectations, all defined in different files.
> A follow-up thought: maybe move all helpers there ({{{}is.{}}}, {{{}as_{}}}, {{{}compare_{}}}, {{verify}} etc).



--
This message was sent by Atlassian Jira
(v8.20.1#820001)