Skip to content

biocViews::recommendBiocViews can't find DESCRIPTION file during unit tests #13

@bschilder

Description

@bschilder

Hi there,

I'm trying to incorporate the biocViews::recommendBiocViews function into of my my package's functions: rworkflows::infer_biocviews:
https://github.com/neurogenomics/rworkflows/blob/master/R/infer_biocviews.R

However when I go to run unit tests with it using testthat, it can't find the DESCRIPTION file. My usual hacks for getting around this directory-specific issue (e.g. setwd("../../") aren't working either.
https://github.com/neurogenomics/rworkflows/blob/master/tests/testthat/test-infer_biocviews.R

So my question is twofold:

  1. Do you know of a way around this issue of finding the DESCRIPTION file during tests more generally (couldn't find any explicit examples in your test folder)?
  2. Could you possibly expose to users the step in which the DESCRIPTION file is imported via a new argument (named something like d or description that expects an object of the class "description")? I have some other functions for (usually) more robustly finding and importing the DESCRIPTION file across a wider variety of scenarios (rworkflows::get_description). Specifically, this step:
    dcf <- read.dcf(descr_file, c("Description", "Title", "Package","biocViews"))

Many thanks in advance!,
Brian

Session info

Details ``` R version 4.2.1 (2022-06-23) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] rworkflows_0.99.7

loaded via a namespace (and not attached):
[1] Biobase_2.58.0 pkgload_1.3.2 jsonlite_1.8.4 here_1.0.1 brio_1.1.3 shiny_1.7.4
[7] BiocManager_1.30.20 rvcheck_0.2.1 stats4_4.2.1 yulab.utils_0.0.6 RBGL_1.74.0 renv_0.17.0
[13] yaml_2.3.7 remotes_2.4.2 sessioninfo_1.2.2 pillar_1.8.1 glue_1.6.2 RUnit_0.4.32
[19] digest_0.6.31 RColorBrewer_1.1-3 promises_1.2.0.1 colorspace_2.1-0 htmltools_0.5.4 httpuv_1.6.9
[25] XML_3.99-0.13 pkgconfig_2.0.3 devtools_2.4.5 purrr_1.0.1 xtable_1.8-4 scales_1.2.1
[31] processx_3.8.0 later_1.3.0 tibble_3.1.8 biocViews_1.66.2 generics_0.1.3 ggplot2_3.4.1
[37] usethis_2.1.6 ellipsis_0.3.2 cachem_1.0.6 withr_2.5.0 BiocGenerics_0.44.0 cli_3.6.0
[43] magrittr_2.0.3 crayon_1.5.2 mime_0.12 evaluate_0.20 memoise_2.0.1 ps_1.7.2
[49] badger_0.2.3 fs_1.6.1 fansi_1.0.4 xml2_1.3.3 pkgbuild_1.4.0 graph_1.76.0
[55] profvis_0.3.7 tools_4.2.1 prettyunits_1.1.1 lifecycle_1.0.3 stringr_1.5.0 munsell_0.5.0
[61] callr_3.7.3 compiler_4.2.1 rlang_1.0.6 grid_4.2.1 RCurl_1.98-1.10 rstudioapi_0.14
[67] htmlwidgets_1.6.1 miniUI_0.1.1.1 rmarkdown_2.20.1 bitops_1.0-7 testthat_3.1.6 gtable_0.3.1
[73] roxygen2_7.2.3 R6_2.5.1 knitr_1.42 dplyr_1.1.0 fastmap_1.1.0 utf8_1.2.3
[79] rprojroot_2.0.3 dlstats_0.1.6 desc_1.4.2 stringi_1.7.12 Rcpp_1.0.10 vctrs_0.5.2
[85] tidyselect_1.2.0 xfun_0.37 urlchecker_1.0.1

</details>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions