You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/02/22 22:45:35 UTC
[GitHub] [arrow] dragosmg commented on a change in pull request #12486: ARROW-15673 [R] Error gracefully if DuckDB isn't installed
dragosmg commented on a change in pull request #12486:
URL: https://github.com/apache/arrow/pull/12486#discussion_r812423235
##########
File path: r/tests/testthat/test-duckdb.R
##########
@@ -15,6 +15,19 @@
# specific language governing permissions and limitations
# under the License.
+test_that("meaningful error message when duckdb is not installed", {
+ new_lib <- tempfile()
+ dir.create(new_lib)
+ withr::with_libpaths(new_lib, {
+ ds <- InMemoryDataset$create(example_data)
+ expect_error(
+ to_duckdb(ds),
+ "Please install the `duckdb` package."
+ )
+ })
+ unlink(new_lib, recursive = TRUE)
Review comment:
`new_lib` works correctly and gets inserted at the first position of `.libPaths()`.
``` r
new_lib <- tempfile()
dir.create(new_lib)
withr::with_libpaths(new_lib, {
.libPaths()
})
#> [1] "/private/var/folders/wx/zjw1jzk11s76vchhc2xym7xw0000gn/T/RtmpHwjdcB/file1ed63169505e"
#> [2] "/Library/Frameworks/R.framework/Versions/4.1/Resources/library"
unlink(new_lib, recursive = TRUE)
```
<sup>Created on 2022-02-22 by the [reprex package](https://reprex.tidyverse.org) (v2.0.1)</sup>
I think the issue is that the system library will always be at `.libPaths()[[2]]`, which means the code above should work provided you have _not_ installed packages in the system library.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org