We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 68d85fb commit eb5d21bCopy full SHA for eb5d21b
tests/testthat/setup.R
@@ -0,0 +1,22 @@
1
+clean_python_tmp_dir <- function() {
2
+
3
+ if(!reticulate::py_available())
4
+ # python never initialized, nothing to do
5
+ return()
6
7
+ python_temp_dir <- dirname(reticulate::py_run_string(
8
+ "import tempfile; x=tempfile.NamedTemporaryFile().name",
9
+ local = TRUE
10
+ )$x)
11
12
+ detritus <- list.files(
13
+ path = python_temp_dir,
14
+ pattern = "__autograph_generated_file|__pycache__",
15
+ full.names = TRUE,
16
+ all.files = TRUE
17
+ )
18
19
+ unlink(detritus, recursive = TRUE)
20
+}
21
22
+withr::defer(clean_python_tmp_dir(), teardown_env())
0 commit comments