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

tests using installed version of hyperSpec #23

Open
cbeleites opened this issue Jul 30, 2021 · 8 comments
Open

tests using installed version of hyperSpec #23

cbeleites opened this issue Jul 30, 2021 · 8 comments

Comments

@cbeleites
Copy link
Collaborator

When I have

  1. the CRAN version of hyperSpec installed, or no hyperSpec installed and
  2. devtools::load_all() the current develop branch and then
  3. devtools::test()

I get test failures.

When the develop version of hyperSpec is installed, the tests run smoothly.

> sessionInfo()
R version 4.1.0 (2021-05-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=de_DE.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=de_DE.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=de_DE.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
[1] hyperSpec_0.100.0.9000 testthat_3.0.4         xml2_1.3.2             ggplot2_3.3.5          lattice_0.20-44       

loaded via a namespace (and not attached):
 [1] pillar_1.6.1              compiler_4.1.0            RColorBrewer_1.1-2        remotes_2.4.0             prettyunits_1.1.1        
 [6] tools_4.1.0               pkgload_1.2.1             pkgbuild_1.2.0            memoise_2.0.0             lifecycle_1.0.0          
[11] tibble_3.1.3              gtable_0.3.0              pkgconfig_2.0.3           png_0.1-7                 rlang_0.4.11             
[16] rstudioapi_0.13           cli_3.0.1                 fastmap_1.1.0             withr_2.4.2               dplyr_1.0.7              
[21] desc_1.3.0                generics_0.1.0            vctrs_0.3.8               fs_1.5.0                  devtools_2.4.2           
[26] rprojroot_2.0.2           tidyselect_1.1.1          glue_1.4.2                R6_2.5.0                  jpeg_0.1-9               
[31] processx_3.5.2            fansi_0.5.0               sessioninfo_1.1.1         latticeExtra_0.6-29       callr_3.7.0              
[36] purrr_0.3.4               magrittr_2.0.1            codetools_0.2-18          usethis_2.0.1             ps_1.6.0                 
[41] scales_1.1.1              ellipsis_0.3.2            hySpc.testthat_0.2.1.9000 colorspace_2.0-2          utf8_1.2.2               
[46] lazyeval_0.2.2            munsell_0.5.0             cachem_1.0.5              crayon_1.4.1             
@cbeleites
Copy link
Collaborator Author

(May be an issue of hySpc.testthat::unittest())

@bryanhanson
Copy link
Contributor

Here's what I get after remove.packages("hyperSpec"), load_all() and then test().


✖ |   0 1     | plotspc                                                         
────────────────────────────────────────────────────────────────────────────────
Error (test-plotspc.r:4:3): BARBITURATES
Error: object 'barbiturates' not found
Backtrace:
 1. testthat::expect_silent(spc <- do.call(collapse, barbiturates[1:3])) test-plotspc.r:4:2
 9. base::do.call(collapse, barbiturates[1:3])
────────────────────────────────────────────────────────────────────────────────

══ Results ═════════════════════════════════════════════════════════════════════
Duration: 22.0 s

── Skipped tests  ──────────────────────────────────────────────────────────────
• empty test (7)
• file import test files not installed (26)
• no spc files with empty spectra available so far (1)
• skip (1)
• TODO: implement (1)

[ FAIL 10 | WARN 14 | SKIP 36 | PASS 761 ]
══ Terminated early ════════════════════════════════════════════════════════════
Warning messages:
1: In setup_ns_exports(path, export_all, export_imports) :
  Objects listed as exports, but not present in namespace: hy_list_available_hySpc_packages
2: In setup_ns_exports(path, export_all, export_imports) :
  Objects listed as exports, but not present in namespace: hy_list_available_hySpc_packages
2021-07-30 14:31:45.954 R[65098:1109795] +[NSSavePanel _warmUp] attempted warmup

When I build with a makefile (my usual process), the same export issue is reported but unit tests pass:

Research/R_Pkgs> make -f makefile_hyperSpec
cd hyperSpec; echo "# Generated by roxygen2: do not edit by hand" >> NAMESPACE
cd hyperSpec; R --no-init-file -e 'devtools::document(roclets = c("rd", "collate", "namespace", "vignette"))'

R version 4.1.0 Patched (2021-07-03 r80596) -- "Camp Pontanezen"
Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> devtools::document(roclets = c("rd", "collate", "namespace", "vignette"))
ℹ Updating hyperSpec documentation
ℹ Loading hyperSpec
Loading required package: lattice
Loading required package: grid
Loading required package: ggplot2
Creating a generic function for ‘apply’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘cov’ from package ‘stats’ in package ‘hyperSpec’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘rownames’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘rownames<-’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘colnames’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘colnames<-’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘sample’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘sweep’ from package ‘base’ in package ‘hyperSpec’


Package hyperSpec (version 0.100.0.9000)

To get started, try: 
   vignette("hyperSpec", package = "hyperSpec")
   package?hyperSpec
   browseVignettes(package = "hyperSpec")
   vignette(package = "hyperSpec")

If you use this package, please cite it appropriately.
The correct reference is given by:
   citation("hyperSpec")

The project's website:
   https://r-hyperspec.github.io/hyperSpec


Writing NAMESPACE
Deleting hy_list_available_hySpc_packages.Rd
Writing NAMESPACE
Updating vignettes
Warning message:
In setup_ns_exports(path, export_all, export_imports) :
  Objects listed as exports, but not present in namespace: hy_list_available_hySpc_packages
> 
> 
R --no-init-file CMD build --resave-data --compact-vignettes=both hyperSpec
* checking for file ‘hyperSpec/DESCRIPTION’ ... OK
* preparing ‘hyperSpec’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* re-saving image files
* building ‘hyperSpec_0.100.0.9000.tar.gz’

export _R_CHECK_CRAN_INCOMING_=FALSE; \
	R --no-init-file CMD check --as-cran hyperSpec_0.100.0.9000.tar.gz
* using log directory ‘/Users/bryanhanson/Documents/Professional/Research/R_Pkgs/hyperSpec.Rcheck’
* using R version 4.1.0 Patched (2021-07-03 r80596)
* using platform: x86_64-apple-darwin17.0 (64-bit)
* using session charset: UTF-8
* using option ‘--as-cran’
* checking for file ‘hyperSpec/DESCRIPTION’ ... OK
* checking extension type ... Package
* this is package ‘hyperSpec’ version ‘0.100.0.9000’
* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether package ‘hyperSpec’ can be installed ... OK
* checking installed package size ... NOTE
  installed size is  7.1Mb
  sub-directories of 1Mb or more:
    doc   5.3Mb
* checking package directory ... OK
* checking for future file timestamps ... OK
* checking ‘build’ directory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd line widths ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking contents of ‘data’ directory ... OK
* checking data for non-ASCII characters ... OK
* checking LazyData ... OK
* checking data for ASCII and uncompressed saves ... OK
* checking R/sysdata.rda ... OK
* checking installed files from ‘inst/doc’ ... OK
* checking files in ‘vignettes’ ... OK
* checking examples ... OK
* checking for unstated dependencies in ‘tests’ ... OK
* checking tests ...
  Running ‘testthat.R’
 OK
* checking for unstated dependencies in vignettes ... OK
* checking package vignettes in ‘inst/doc’ ... OK
* checking re-building of vignette outputs ... OK
* checking PDF version of manual ... OK
* checking for non-standard things in the check directory ... OK
* checking for detritus in the temp directory ... OK
* DONE

Status: 1 NOTE
See
  ‘/Users/bryanhanson/Documents/Professional/Research/R_Pkgs/hyperSpec.Rcheck/00check.log’
for details.


R --no-init-file CMD INSTALL hyperSpec_0.100.0.9000.tar.gz
* installing to library ‘/Library/Frameworks/R.framework/Versions/4.1/Resources/library’
* installing *source* package ‘hyperSpec’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Creating a generic function for ‘apply’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘cov’ from package ‘stats’ in package ‘hyperSpec’
Creating a generic function for ‘ncol’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘nrow’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘rownames’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘rownames<-’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘colnames’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘colnames<-’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘sample’ from package ‘base’ in package ‘hyperSpec’
Creating a generic function for ‘sweep’ from package ‘base’ in package ‘hyperSpec’
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (hyperSpec)

@cbeleites
Copy link
Collaborator Author

cbeleites commented Jul 30, 2021

@bryanhanson: yes thanks.

Note to self at end of day: hySpc.testthat::unittest() should first check whether ns %in% devtools::dev_packages(). If so, it's a package loaded by devtools.

In that case, look recursively through parent.env(.GlobalEnv) for paste0("package:", ns).

If another namespace is requested, use getNamespace() is the way to go.

@cbeleites
Copy link
Collaborator Author

see r-hyperspec/hySpc.testthat#16

@GegznaV
Copy link
Member

GegznaV commented Jul 31, 2021

It's not clear to me: is this issue (#23) blocked ⛔ until the following issue is solved?

@cbeleites
Copy link
Collaborator Author

@GegznaV yes

@GegznaV
Copy link
Member

GegznaV commented Aug 7, 2022

I think, hyperSpec 1.0.0 can work without these changes, so I'll change the milestone.

@GegznaV
Copy link
Member

GegznaV commented Aug 7, 2022

If it is fixed sooner, it's ok.

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

No branches or pull requests

3 participants