mirror of
https://github.com/rclone/rclone.git
synced 2025-08-17 17:11:37 +02:00
test: use T.TempDir
to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the test and all its subtests complete. Reference: https://pkg.go.dev/testing#T.TempDir Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
committed by
Nick Craig-Wood
parent
18c24014da
commit
8cf76f5e11
@ -2,7 +2,6 @@ package webgui
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@ -24,13 +23,12 @@ func init() {
|
||||
}
|
||||
|
||||
func setCacheDir(t *testing.T) string {
|
||||
cacheDir, err := ioutil.TempDir("", "rclone-cache-dir")
|
||||
assert.Nil(t, err)
|
||||
cacheDir := t.TempDir()
|
||||
PluginsPath = filepath.Join(cacheDir, "plugins")
|
||||
pluginsConfigPath = filepath.Join(cacheDir, "config")
|
||||
|
||||
loadedPlugins = newPlugins(availablePluginsJSONPath)
|
||||
err = loadedPlugins.readFromFile()
|
||||
err := loadedPlugins.readFromFile()
|
||||
assert.Nil(t, err)
|
||||
return cacheDir
|
||||
}
|
||||
|
Reference in New Issue
Block a user