Skip to content

Commit 409a016

Browse files
authored
GH-45716: [R][CI] Refactor skip_on_python_older_than to not initialize reticulate (#46079)
### Rationale for this change This fixes our `test-r-offline-maximal` job which started failing because of a change in reticulate 1.41.0. ### What changes are included in this PR? Changed internals of our skip_on_python_older_than helper. ### Are these changes tested? Locally, need to test in CI before merging. ### Are there any user-facing changes? No. * GitHub Issue: #45716 Authored-by: Bryce Mecum <[email protected]> Signed-off-by: Bryce Mecum <[email protected]>
1 parent 278fa14 commit 409a016

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

r/tests/testthat/helper-skip.R

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,16 @@ skip_on_python_older_than <- function(python_version) {
116116
return()
117117
}
118118

119-
if (!reticulate::py_available(initialize = TRUE)) {
119+
# We want to be careful not to initialize reticulate in this helper function
120+
config <- reticulate::py_discover_config()
121+
122+
# It isn't documented, but config should be NULL when py_discovery_config()
123+
# fails to find a valid Python installation
124+
if (is.null(config)) {
120125
skip("Python isn't available")
121126
}
122127

123-
if (reticulate::py_version() < python_version) {
128+
if (config$version < python_version) {
124129
skip(paste("Python version:", reticulate::py_version()))
125130
}
126131
}

0 commit comments

Comments
 (0)