Skip to content

Commit

Permalink
Merge branch 'v2-example_package'
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdesmet committed Aug 29, 2024
2 parents d5e723e + b139e89 commit bb052ed
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-add_resource.R
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ test_that("add_resource() can add resource from local, relative, absolute,
# Remote
remote_path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)
p <- add_resource(p, "remote", remote_path, schema)
expect_identical(p$resources[[7]]$path, remote_path)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-read_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_that("read_package() returns a valid Data Package reading from url", {
# Load example package remotely
p_url <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r/",
"main/inst/extdata/datapackage.json"
"main/inst/extdata/v1/datapackage.json"
)
p_remote <- read_package(p_url)

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-read_resource.R
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ test_that("read_resource() can read remote files", {
p_remote_resource <- p
p_remote_resource$resources[[1]]$path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)
expect_identical(read_resource(p_remote_resource, "deployments"), resource)
})
Expand All @@ -316,7 +316,7 @@ test_that("read_resource() can read safe local and remote Table Schema,
# Use a remote path, otherwise schema and path need to share same directory
p$resources[[1]]$path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)

# Schema is absolute path
Expand Down Expand Up @@ -364,7 +364,7 @@ test_that("read_resource() can read safe local and remote CSV dialect", {
# Use a remote path, otherwise dialect and path need to share same directory
p$resources[[1]]$path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)

# Dialect is absolute path
Expand Down
22 changes: 11 additions & 11 deletions tests/testthat/test-write_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test_that("write_package() does not overwrite existing data files", {
# Change local path to URL
p$resources[[1]]$path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)
dir <- file.path(tempdir(), "package")
on.exit(unlink(dir, recursive = TRUE))
Expand Down Expand Up @@ -94,7 +94,7 @@ test_that("write_package() copies file(s) for path = local in local package", {
# Change one local path to URL
p$resources[[2]]$path[[1]] <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/observations_1.tsv"
"main/inst/extdata/v1/observations_1.tsv"
)
p <- add_resource(p, "new", test_path("data/df.csv"))
dir <- file.path(tempdir(), "package")
Expand Down Expand Up @@ -126,13 +126,13 @@ test_that("write_package() downloads file(s) for path = local in remote
# Make remote
p$directory <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r/",
"main/inst/extdata"
"main/inst/extdata/v1"
)

# Change one local path to URL
p$resources[[2]]$path[[1]] <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/observations_1.tsv"
"main/inst/extdata/v1/observations_1.tsv"
)
p <- add_resource(p, "new", test_path("data/df.csv"))
dir <- file.path(tempdir(), "package")
Expand Down Expand Up @@ -163,7 +163,7 @@ test_that("write_package() leaves as is for path = URL in local package", {
# Change local path to URL
p$resources[[1]]$path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)
p <- add_resource(p, "new", file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
Expand All @@ -189,13 +189,13 @@ test_that("write_package() leaves as is for path = URL in remote package", {
# Make remote
p$directory <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r/",
"main/inst/extdata"
"main/inst/extdata/v1"
)

# Change local path to URL
p$resources[[1]]$path <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/deployments.csv"
"main/inst/extdata/v1/deployments.csv"
)
p <- add_resource(p, "new", file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
Expand Down Expand Up @@ -234,7 +234,7 @@ test_that("write_package() leaves as is for data = json in remote package", {
# Make remote
p$directory <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r/",
"main/inst/extdata"
"main/inst/extdata/v1"
)
dir <- file.path(tempdir(), "package")
on.exit(unlink(dir, recursive = TRUE))
Expand Down Expand Up @@ -270,7 +270,7 @@ test_that("write_package() creates file for data = df in remote package", {
# Make remote
p$directory <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r/",
"main/inst/extdata"
"main/inst/extdata/v1"
)
df <- data.frame("col_1" = c(1, 2), "col_2" = c("a", "b"))
p <- add_resource(p, "new", df)
Expand All @@ -293,7 +293,7 @@ test_that("write_package() shows message when downloading file", {
# Change one local path to URL
p$resources[[2]]$path[[1]] <- file.path(
"https://raw.githubusercontent.com/frictionlessdata/frictionless-r",
"main/inst/extdata/observations_1.tsv"
"main/inst/extdata/v1/observations_1.tsv"
)
dir <- file.path(tempdir(), "package")
dir_1 <- file.path(dir, "1")
Expand All @@ -307,7 +307,7 @@ test_that("write_package() shows message when downloading file", {
write_package(p, dir_2),
regexp = paste0(
"Downloading file from 'https://raw.githubusercontent.com/",
"frictionlessdata/frictionless-r/main/inst/extdata/observations_1.tsv'"
"frictionlessdata/frictionless-r/main/inst/v1/extdata/observations_1.tsv'"
),
fixed = TRUE
)
Expand Down

0 comments on commit bb052ed

Please sign in to comment.