diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-26 14:11:37 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-02-27 13:28:33 -0300 |
commit | 6bc6ede826843c3692971c14c27c3d27714b2126 (patch) | |
tree | a15196f6617c6cd6d683b69c51a26f57940d55bd /spec/util/test_env.lua | |
parent | e0aa47df12c9b9beb05d380aac7d90a28a081a7b (diff) | |
download | luarocks-6bc6ede826843c3692971c14c27c3d27714b2126.tar.gz luarocks-6bc6ede826843c3692971c14c27c3d27714b2126.tar.bz2 luarocks-6bc6ede826843c3692971c14c27c3d27714b2126.zip |
tests(fetch): do not use restserver
Diffstat (limited to '')
-rw-r--r-- | spec/util/test_env.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/util/test_env.lua b/spec/util/test_env.lua index 41787cb7..f311a370 100644 --- a/spec/util/test_env.lua +++ b/spec/util/test_env.lua | |||
@@ -193,10 +193,25 @@ function test_env.run_in_tmp(f, finally) | |||
193 | lfs.mkdir(tmpdir) | 193 | lfs.mkdir(tmpdir) |
194 | lfs.chdir(tmpdir) | 194 | lfs.chdir(tmpdir) |
195 | 195 | ||
196 | if not finally then | ||
197 | error("run_in_tmp needs a finally argument") | ||
198 | end | ||
199 | |||
200 | -- for unit tests, so that current dir known by luarocks.fs (when running with non-lfs) | ||
201 | -- is synchronized with actual lfs (system) current dir | ||
202 | local fs = require("luarocks.fs") | ||
203 | if not fs.change_dir then | ||
204 | local cfg = require("luarocks.core.cfg") | ||
205 | cfg.init() | ||
206 | fs.init() | ||
207 | end | ||
208 | fs.change_dir(tmpdir) | ||
209 | |||
196 | if finally then | 210 | if finally then |
197 | finally(function() | 211 | finally(function() |
198 | lfs.chdir(olddir) | 212 | lfs.chdir(olddir) |
199 | lfs.rmdir(tmpdir) | 213 | lfs.rmdir(tmpdir) |
214 | fs.change_dir(olddir) | ||
200 | end) | 215 | end) |
201 | end | 216 | end |
202 | 217 | ||