mirror of https://github.com/databricks/cli.git
refactor: Add context import and TODOs for test improvements
This commit is contained in:
parent
5276a5b461
commit
c0cd244e22
|
@ -2,6 +2,7 @@ package patchwheel
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
@ -12,6 +13,7 @@ import (
|
||||||
|
|
||||||
// minimalPythonProject returns a map of file paths to their contents for a minimal Python project.
|
// minimalPythonProject returns a map of file paths to their contents for a minimal Python project.
|
||||||
func minimalPythonProject() map[string]string {
|
func minimalPythonProject() map[string]string {
|
||||||
|
// AI TODO: switch to pyproject.toml here
|
||||||
return map[string]string{
|
return map[string]string{
|
||||||
// A simple setup.py that uses setuptools.
|
// A simple setup.py that uses setuptools.
|
||||||
"setup.py": `from setuptools import setup, find_packages
|
"setup.py": `from setuptools import setup, find_packages
|
||||||
|
@ -58,6 +60,7 @@ func TestPatchWheel(t *testing.T) {
|
||||||
for _, py := range pythonVersions {
|
for _, py := range pythonVersions {
|
||||||
t.Run(py, func(t *testing.T) {
|
t.Run(py, func(t *testing.T) {
|
||||||
// Create a temporary directory for the project.
|
// Create a temporary directory for the project.
|
||||||
|
// AI TODO: use t.TempDir() instead
|
||||||
tempDir, err := ioutil.TempDir("", "myproj")
|
tempDir, err := ioutil.TempDir("", "myproj")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
@ -72,6 +75,7 @@ func TestPatchWheel(t *testing.T) {
|
||||||
|
|
||||||
// Create a virtual environment.
|
// Create a virtual environment.
|
||||||
venvDir := filepath.Join(tempDir, "venv")
|
venvDir := filepath.Join(tempDir, "venv")
|
||||||
|
// AI TODO: use "uv init --python <python>" to create venv
|
||||||
if out, err := runCmd(tempDir, py, "-m", "venv", "venv"); err != nil {
|
if out, err := runCmd(tempDir, py, "-m", "venv", "venv"); err != nil {
|
||||||
t.Fatalf("venv creation failed: %v, output: %s", err, out)
|
t.Fatalf("venv creation failed: %v, output: %s", err, out)
|
||||||
}
|
}
|
||||||
|
@ -107,8 +111,10 @@ func TestPatchWheel(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("PatchWheel failed: %v", err)
|
t.Fatalf("PatchWheel failed: %v", err)
|
||||||
}
|
}
|
||||||
|
t.Logf("origWheel=%s patchedWheel=%s", origWheel, patchedWheel)
|
||||||
|
|
||||||
// Install the patched wheel.
|
// Install the patched wheel.
|
||||||
|
// AI TODO: use uv
|
||||||
if out, err := runCmd(tempDir, pipExec, "install", "--force-reinstall", patchedWheel); err != nil {
|
if out, err := runCmd(tempDir, pipExec, "install", "--force-reinstall", patchedWheel); err != nil {
|
||||||
t.Fatalf("failed to install patched wheel: %v, output: %s", err, out)
|
t.Fatalf("failed to install patched wheel: %v, output: %s", err, out)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue