|
1 | 1 | using PyCall, Test |
2 | 2 |
|
| 3 | +"""Gets temp directory, possibly with user-set environment variable""" |
| 4 | +function _mktempdir(f::Function, parent=nothing; kwargs...) |
| 5 | + if parent === nothing && haskey(ENV, "_TMP_DIR") |
| 6 | + return mktempdir(f, ENV["_TMP_DIR"]; kwargs...) |
| 7 | + end |
| 8 | + if parent === nothing |
| 9 | + parent = tempdir() |
| 10 | + end |
| 11 | + return mktempdir(f, parent; kwargs...) |
| 12 | +end |
| 13 | + |
3 | 14 |
|
4 | 15 | function test_venv_has_python(path) |
5 | 16 | newpython = PyCall.python_cmd(venv=path).exec[1] |
@@ -35,7 +46,7 @@ function test_venv_activation(path) |
35 | 46 | # Marking the test broken in Windows. It seems that |
36 | 47 | # venv copies .dll on Windows and libpython check in |
37 | 48 | # PyCall.__init__ detects that. |
38 | | - @test_broken begin |
| 49 | + @test begin |
39 | 50 | output = read(jlcmd, String) |
40 | 51 | sys_executable, exec_prefix, mod_file = split(output, "\n") |
41 | 52 | newpython == sys_executable |
|
57 | 68 | elseif Sys.which(pyname) === nothing |
58 | 69 | @info "No $pyname command. Skipping the test..." |
59 | 70 | else |
60 | | - mktempdir() do tmppath |
| 71 | + _mktempdir() do tmppath |
61 | 72 | if PyCall.pyversion.major == 2 |
62 | 73 | path = joinpath(tmppath, "kind") |
63 | 74 | else |
|
108 | 119 | elseif !success(PyCall.python_cmd(`-c "import venv"`, python=python)) |
109 | 120 | @info "Skip venv test since venv package is missing." |
110 | 121 | else |
111 | | - mktempdir() do tmppath |
| 122 | + _mktempdir() do tmppath |
112 | 123 | if PyCall.pyversion.major == 2 |
113 | 124 | path = joinpath(tmppath, "kind") |
114 | 125 | else |
|
0 commit comments