File: test-python-import-hook.R

package info (click to toggle)
r-cran-reticulate 1.41.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,088 kB
  • sloc: cpp: 5,154; python: 620; sh: 13; makefile: 2
file content (16 lines) | stat: -rw-r--r-- 451 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
context("imports")

test_that("The reticulate import hook handles recursive imports", {

  skip_if_no_matplotlib()

  R <- file.path(R.home("bin"), "R")
  script <- "resources/import-test.R"
  args <- c("--no-save", "--no-restore", "-s", "-f", shQuote(script))
  output <- system2(R, args, stdout = TRUE, stderr = TRUE)

  pattern <- "Loaded module '(.*)'"
  modules <- gsub(pattern, "\\1", output)
  expect_true("matplotlib.pyplot" %in% modules)

})