-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to specify temp filenames in 'mhcnuggetsr_self_test'
- Loading branch information
richelbilderbeek
committed
Feb 27, 2021
1 parent
c9e14b1
commit 1c24ab3
Showing
10 changed files
with
168 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,37 @@ | ||
#' Install pip. | ||
#' @param python_script_filename name of a temporary Python | ||
#' script file. Will be deleted at the end of the function | ||
#' @return Nothing | ||
#' @examples | ||
#' \dontrun{ | ||
#' install_pip() | ||
#' } | ||
#' @author Richèl J.C. Bilderbeek | ||
#' @export | ||
install_pip <- function() { | ||
script_filename <- tempfile() | ||
install_pip <- function( | ||
python_script_filename = file.path( | ||
tmpdir = rappdirs::user_cache_dir(), | ||
"temp_install_pip.py" | ||
) | ||
) { | ||
dir.create( | ||
dirname(python_script_filename), | ||
showWarnings = FALSE, | ||
recursive = TRUE | ||
) | ||
|
||
utils::download.file( | ||
url = "https://bootstrap.pypa.io/get-pip.py", | ||
destfile = script_filename, | ||
destfile = python_script_filename, | ||
quiet = TRUE | ||
) | ||
system2( | ||
error_code <- system2( | ||
reticulate::py_config()$python, | ||
args = c(script_filename, "--user"), | ||
args = c(python_script_filename, "--user"), | ||
stdout = FALSE | ||
) | ||
|
||
file.remove(python_script_filename) | ||
|
||
error_code | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
test_that("use", { | ||
test_that("default use", { | ||
if (is_mhcnuggets_installed()) { | ||
expect_silent(mhcnuggetsr_self_test()) | ||
} else { | ||
expect_error(mhcnuggetsr_self_test()) | ||
} | ||
}) | ||
|
||
test_that("verbosity", { | ||
if (is_mhcnuggets_installed()) { | ||
expect_message(mhcnuggetsr_self_test(verbose = TRUE)) | ||
} else { | ||
expect_message(mhcnuggetsr_self_test(verbose = TRUE)) | ||
} | ||
}) | ||
|
||
test_that("detailed use", { | ||
if (!is_mhcnuggets_installed()) return() | ||
|
||
mhcnuggets_options <- create_test_mhcnuggets_options() | ||
peptides_path <- create_temp_peptides_path() | ||
mhcnuggets_output_filename = mhcnuggetsr::create_temp_peptides_path( | ||
fileext = ".csv" | ||
) | ||
expect_silent( | ||
mhcnuggetsr_self_test( | ||
mhcnuggets_options = mhcnuggets_options, | ||
peptides_path = peptides_path, | ||
mhcnuggets_output_filename = mhcnuggets_output_filename, | ||
verbose = FALSE | ||
) | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters