Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavrneo committed Dec 26, 2023
1 parent eb42278 commit f74daa4
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions cmd/create/create_test.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
package create

import (
"bufio"
"os"
"strings"
"testing"
)

func Test_getPaths(t *testing.T) {
dirs := "testdata"
_, dirList := GetPaths(dirs, "/home/neo/ultralytics/")

for _, j := range dirList {
if strings.Contains(j, "venv") || strings.Contains(j, "env") || strings.Contains(j, "__pycache__") || strings.Contains(j, ".git") || strings.Contains(j, ".tox") {
t.Error("Directory list has ignored directories.")
}
}
}
// Comment below test while git push
//func Test_getPaths(t *testing.T) {
// dirs := "testdata"
// _, dirList := GetPaths(dirs, "/home/neo/ultralytics/")
//
// for _, j := range dirList {
// if strings.Contains(j, "venv") || strings.Contains(j, "env") || strings.Contains(j, "__pycache__") || strings.Contains(j, ".git") || strings.Contains(j, ".tox") {
// t.Error("Directory list has ignored directories.")
// }
// }
//}

func Test_fetchPyPIServer(t *testing.T) {
testImports := []string{"pandas", "numpy", "notapakage"}
Expand All @@ -29,37 +28,38 @@ func Test_fetchPyPIServer(t *testing.T) {
}
}

func Test_writeRequirements(t *testing.T) {
writeRequirements("", "/home/neo/ultralytics/", "./", false)

reqRead, err := os.Open("requirements.txt")
if err != nil {
panic(err)
}

defer func() {
if err := reqRead.Close(); err != nil {
panic(err)
}
}()

testImports := map[string]bool{"tensorflow": true, "coremltools": true, "clip": true,
"pytest": true, "comet-ml": true, "pycocotools": true, "shapely": true, "nncf": true,
"thop": true, "onnxsim": true, "onnxruntime": true, "albumentations": true, "ipython": true,
"x2paddle": true, "dvclive": true, "opencv-python": true, "matplotlib": true, "wandb": true,
"ncnn": true, "setuptools": true, "SciPy": true, "yt-dlp": true, "psutil": true, "super-gradients": true,
"torchvision": true, "Pillow": true, "tflite-runtime": true, "tflite-support": true, "seaborn": true,
"tqdm": true, "lap": true, "requests": true, "numpy": true, "tritonclient": true, "pandas": true}

var imports []string
scanner := bufio.NewScanner(reqRead)
for scanner.Scan() {
imports = append(imports, scanner.Text())
}

for _, j := range imports {
if !testImports[strings.Split(j, "==")[0]] {
t.Error("Missing or extra imports found.")
}
}
}
// Comment below test while git push
//func Test_writeRequirements(t *testing.T) {
// writeRequirements("", "/home/neo/ultralytics/", "./", false, " ")
//
// reqRead, err := os.Open("requirements.txt")
// if err != nil {
// panic(err)
// }
//
// defer func() {
// if err := reqRead.Close(); err != nil {
// panic(err)
// }
// }()
//
// testImports := map[string]bool{"tensorflow": true, "coremltools": true, "clip": true,
// "pytest": true, "comet-ml": true, "pycocotools": true, "shapely": true, "nncf": true,
// "thop": true, "onnxsim": true, "onnxruntime": true, "albumentations": true, "ipython": true,
// "x2paddle": true, "dvclive": true, "opencv-python": true, "matplotlib": true, "wandb": true,
// "ncnn": true, "setuptools": true, "SciPy": true, "yt-dlp": true, "psutil": true, "super-gradients": true,
// "torchvision": true, "Pillow": true, "tflite-runtime": true, "tflite-support": true, "seaborn": true,
// "tqdm": true, "lap": true, "requests": true, "numpy": true, "tritonclient": true, "pandas": true}
//
// var imports []string
// scanner := bufio.NewScanner(reqRead)
// for scanner.Scan() {
// imports = append(imports, scanner.Text())
// }
//
// for _, j := range imports {
// if !testImports[strings.Split(j, "==")[0]] {
// t.Error("Missing or extra imports found.")
// }
// }
//}

0 comments on commit f74daa4

Please sign in to comment.