Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #2577: Add unit tests for set_admiral_options #2589

Merged
merged 5 commits into from
Dec 20, 2024

Conversation

Anthogonyst
Copy link
Contributor

Thank you for your Pull Request! We have developed this task checklist from the Development Process Guide to help with the final steps of the process. Completing the below tasks helps to ensure our reviewers can maximize their time on your code as well as making sure the admiral codebase remains robust and consistent.

Please check off each taskbox as an acknowledgment that you completed the task or check off that it is not relevant to your Pull Request. This checklist is part of the Github Action workflows and the Pull Request will not be merged into the main branch until you have checked off each task.

  • Place Closes #<insert_issue_number> into the beginning of your Pull Request Title (Use Edit button in top-right if you need to update)
  • Code is formatted according to the tidyverse style guide. Run styler::style_file() to style R and Rmd files
  • Updated relevant unit tests or have written new unit tests, which should consider realistic data scenarios and edge cases, e.g. empty datasets, errors, boundary cases etc. - See Unit Test Guide
  • If you removed/replaced any function and/or function parameters, did you fully follow the deprecation guidance?
  • Review the Cheat Sheet. Make any required updates to it by editing the file inst/cheatsheet/admiral_cheatsheet.pptx and re-upload a PDF and a PNG version of it to the same folder. (The PNG version can be created by taking a screenshot of the PDF version.)
  • Update to all relevant roxygen headers and examples, including keywords and families. Refer to the categorization of functions to tag appropriate keyword/family.
  • Run devtools::document() so all .Rd files in the man folder and the NAMESPACE file in the project root are updated appropriately
  • Address any updates needed for vignettes and/or templates
  • Update NEWS.md under the header # admiral (development version) if the changes pertain to a user-facing function (i.e. it has an @export tag) or documentation aimed at users (rather than developers). A Developer Notes section is available in NEWS.md for tracking developer-facing issues.
  • Build admiral site pkgdown::build_site() and check that all affected examples are displayed correctly and that all new functions occur on the "Reference" page.
  • Address or fix all lintr warnings and errors - lintr::lint_package()
  • Run R CMD check locally and address all errors and warnings - devtools::check()
  • Link the issue in the Development Section on the right hand side.
  • Address all merge conflicts and resolve appropriately
  • Pat yourself on the back for a job well done! Much love to your accomplishment!

@Anthogonyst
Copy link
Contributor Author

Let me know if I can do anything to improve this. I didn't name it "Closed #2577 " since it doesn't address 2/3 bullet points.

In regards to roxygen_param_by_vars, I can write a test where it compares strings but it seems redundant somehow?

In regards to use_ad_template, the function file.edit opens a new window and could block the stack. I'm not sure if it should be considered for test coverage but if mandatory, perhaps a substitution should be employed? I don't recall the exact method I've used in the past even though it's possible. It's probable that any kind of sql/db query employs this technique.

@bms63
Copy link
Collaborator

bms63 commented Dec 2, 2024

Let me know if I can do anything to improve this. I didn't name it "Closed #2577 " since it doesn't address 2/3 bullet points.

In regards to roxygen_param_by_vars, I can write a test where it compares strings but it seems redundant somehow?

I'm interested in moving this function out of admiral or just not testing it all. I believe we can tell testthat that it is not code we want to test. WDYT @manciniedoardo and @bundfussr ?

In regards to use_ad_template, the function file.edit opens a new window and could block the stack. I'm not sure if it should be considered for test coverage but if mandatory, perhaps a substitution should be employed? I don't recall the exact method I've used in the past even though it's possible. It's probable that any kind of sql/db query employs this technique.

Could we use temp_file <- tempfile() in the test

@bms63
Copy link
Collaborator

bms63 commented Dec 2, 2024

Umm...maybe we should re-look at the interactive portion of this function??

@manciniedoardo
Copy link
Collaborator

Happy to reevaluate the testing for this function, but I do think the best place for it remains the admiral package itself.

@bms63
Copy link
Collaborator

bms63 commented Dec 2, 2024

roxygen_param_by_vars

We should split out from this PR/ISsue as roxygen_param_by_vars was an experimental function. We don't really have proper documentation for it. Fine if we want to add tests to it, but we should probably also document it now that it is being used more
(https://github.com/pharmaverse/admiral/blob/main/R/roxygen2.R)

@bms63 bms63 requested a review from manciniedoardo December 11, 2024 15:38
@manciniedoardo manciniedoardo changed the title Related #2577: Add unit tests for set_admiral_options Closes #2577: Add unit tests for set_admiral_options Dec 12, 2024
@manciniedoardo
Copy link
Collaborator

Note: i updated #2577 so it only refers to set_admiral_options(), then this PR would close that issue.

Copy link
Collaborator

@manciniedoardo manciniedoardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Anthogonyst look great! Just a minor comment.

tests/testthat/test-admiral_options.R Outdated Show resolved Hide resolved
@bms63
Copy link
Collaborator

bms63 commented Dec 16, 2024

@Anthogonyst are you able to complete this? - we split out the tests so this is the only one to complete now.

@Anthogonyst
Copy link
Contributor Author

Sure thing. Here you go, the test comments are updated. @manciniedoardo @bms63

Copy link
Collaborator

@bms63 bms63 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! not sure what adventure you want to go on #2605 is a quick one but kind of interesting i think

@bms63 bms63 merged commit 4dfaa3b into pharmaverse:main Dec 20, 2024
18 of 19 checks passed
@manciniedoardo
Copy link
Collaborator

@Anthogonyst - totally up to you, but if you do want to pass us your name we can acknowledge your contribution in the README

@Anthogonyst
Copy link
Contributor Author

@bms63 @manciniedoardo If you can add my name as "Anthony Arroyo" in the contributions list, that would be great. I'm not entirely sure what my next steps are at the moment. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants