Skip to content

Commit

Permalink
Refactor PythonSpecific
Browse files Browse the repository at this point in the history
Signed-off-by: nojaf <[email protected]>
  • Loading branch information
nojaf committed Oct 19, 2024
1 parent d6081fd commit 069212c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ mage test:python

```bash
# Run specific MLflow Python tests (matches all tests containing the argument)
mage test:pythonSpecific <test_name>
mage test:pythonSpecific <test_file::test_name>

#Example
mage test:pythonSpecific ".mlflow.repo/tests/tracking/test_rest_tracking.py::test_rename_experiment"
```

```bash
Expand Down
22 changes: 7 additions & 15 deletions magefiles/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func cleanUpMemoryFile() error {
return nil
}

func runPythonTests(testFiles []string, testName string) error {
func runPythonTests(pytestArgs []string) error {
libpath, err := os.MkdirTemp("", "")
if err != nil {
return err
Expand All @@ -46,15 +46,9 @@ func runPythonTests(testFiles []string, testName string) error {

args := []string{
"--confcutdir=.",
"-k", "not [file",
}
args = append(args, testFiles...)

// Add testName filter if provided
if testName != "" {
args = append(args, "-k", testName, "-vv")
} else {
args = append(args, "-k", "not [file")
}
args = append(args, pytestArgs...)

// Run the tests (currently just the server ones)
if err := sh.RunWithV(map[string]string{
Expand All @@ -75,17 +69,15 @@ func (Test) Python() error {
".mlflow.repo/tests/tracking/test_model_registry.py",
".mlflow.repo/tests/store/tracking/test_sqlalchemy_store.py",
".mlflow.repo/tests/store/model_registry/test_sqlalchemy_store.py",
}, "")
})
}

// Run specific Python test against the Go backend.
func (Test) PythonSpecific(testName string) error {
return runPythonTests([]string{
".mlflow.repo/tests/tracking/test_rest_tracking.py",
".mlflow.repo/tests/tracking/test_model_registry.py",
".mlflow.repo/tests/store/tracking/test_sqlalchemy_store.py",
".mlflow.repo/tests/store/model_registry/test_sqlalchemy_store.py",
}, testName)
testName,
"-vv",
})
}

// Run the Go unit tests.
Expand Down

0 comments on commit 069212c

Please sign in to comment.