Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions python/utils.go
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,16 +5,16 @@ package python
import (
"context"
"os"
"path"
"path/filepath"
"strings"

"github.com/databricks/cli/libs/log"
)

func CleanupWheelFolder(dir string) {
// there or not there - we don't care
os.RemoveAll(path.Join(dir, "__pycache__"))
os.RemoveAll(path.Join(dir, "build"))
os.RemoveAll(filepath.Join(dir, "__pycache__"))
os.RemoveAll(filepath.Join(dir, "build"))
eggInfo := FindFilesWithSuffixInPath(dir, ".egg-info")
if len(eggInfo) == 0 {
return
Expand DownExpand Up@@ -42,7 +42,7 @@ func FindFilesWithSuffixInPath(dir, suffix string) []string {
if !strings.HasSuffix(child.Name(), suffix) {
continue
}
files = append(files, path.Join(dir, child.Name()))
files = append(files, filepath.Join(dir, child.Name()))
}
return files
}
21 changes: 21 additions & 0 deletions python/utils_test.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
package python

import (
"os"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"
)

func TestFindFilesWithSuffixInPath(t *testing.T) {
dir, err := os.Getwd()
require.NoError(t, err)

files := FindFilesWithSuffixInPath(dir, "test.go")

matches, err := filepath.Glob(filepath.Join(dir, "*test.go"))
require.NoError(t, err)

require.ElementsMatch(t, files, matches)
}