Skip to content

Commit

Permalink
Use system.file() for reading files in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
damianooldoni committed Feb 7, 2023
1 parent fb016e4 commit 35b3b0f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
18 changes: 12 additions & 6 deletions tests/testthat/test-output_apply_gam.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,23 @@ df_bad <- data.frame(
)

df_bad_p_values_occupancy <- read.delim(
paste0(
"./data_test_output_apply_gam/",
"example_gam_taxonKey2876049_p-values_error.tsv"
file = system.file(
"tests",
"testthat",
"data_test_output_apply_gam",
"example_gam_taxonKey2876049_p-values_error.tsv",
package = "trias"
),
sep = "\t"
)

df_bad_gam_not_perf <- read.delim(
paste0(
"./data_test_output_apply_gam/",
"example_gam_taxonKey2927530_no_gam.tsv"
system.file(
"tests",
"testthat",
"data_test_output_apply_gam",
"example_gam_taxonKey2927530_no_gam.tsv",
package = "trias"
),
sep = "\t"
)
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-visualize_pathways_level1.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ context("test_visualize_pathways_level1")

# input df
input_test_df <- read.delim(
paste0(
"./data_test_pathways/",
"input_data_pathways.tsv"
system.file("tests",
"testthat",
"data_test_pathways",
"input_data_pathways.tsv",
package = "trias"
),
sep = "\t",
stringsAsFactors = FALSE
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-visualize_pathways_level2.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ context("test_visualize_pathways_level2")

# input df
input_test_df <- read.delim(
paste0(
"./data_test_pathways/",
"input_data_pathways.tsv"
system.file("tests",
"testthat",
"data_test_pathways",
"input_data_pathways.tsv",
package = "trias"
),
sep = "\t",
stringsAsFactors = FALSE
Expand Down

0 comments on commit 35b3b0f

Please sign in to comment.