Worker: check BLENDER_CMD environment variable (for multi-GPU Eevee rendering) #104193
@ -45,17 +45,21 @@ func TestGetBlenderVersion(t *testing.T) {
|
|||||||
|
|
||||||
func TestGetBlenderCommandFromEnvironment(t *testing.T) {
|
func TestGetBlenderCommandFromEnvironment(t *testing.T) {
|
||||||
|
|
||||||
// Without environment variable, we expect an empty string
|
// If the environment variable is unset or empty, we expect an empty string
|
||||||
|
err := os.Unsetenv(BlenderPathEnvVariable)
|
||||||
MKRelax marked this conversation as resolved
Outdated
|
|||||||
|
assert.NoError(t, err, "Could not clear blender executable from environment")
|
||||||
path := EnvironmentVariable()
|
path := EnvironmentVariable()
|
||||||
assert.Equal(t, "", path)
|
assert.Equal(t, "", path)
|
||||||
|
|
||||||
// Try finding the blender path in the environment variable
|
err = os.Setenv(BlenderPathEnvVariable, "")
|
||||||
err := os.Setenv(BlenderPathEnvVariable, "/path/specified/in/env/to/blender")
|
assert.NoError(t, err, "Could not set blender executable in environment")
|
||||||
MKRelax marked this conversation as resolved
Outdated
Sybren A. Stüvel
commented
The The `if` and `t.Fatal()` can be replaced with `require.NoError(t, err, "Could not set BLENDER_CMD environment variable")`.
|
|||||||
if err != nil {
|
|
||||||
t.Fatal("Could not set blender executable in environment variable")
|
|
||||||
}
|
|
||||||
|
|
||||||
path = EnvironmentVariable()
|
path = EnvironmentVariable()
|
||||||
assert.Equal(t, "/path/specified/in/env/to/blender", path)
|
assert.Equal(t, "", path)
|
||||||
|
|
||||||
|
// Try finding the blender path in the environment variable
|
||||||
|
envExe := `D:\Blender_3.2_stable\blender.exe`
|
||||||
|
err = os.Setenv(BlenderPathEnvVariable, envExe)
|
||||||
|
assert.NoError(t, err, "Could not set blender executable in environment")
|
||||||
|
path = EnvironmentVariable()
|
||||||
|
assert.Equal(t, envExe, path)
|
||||||
}
|
}
|
||||||
|
@ -90,9 +90,7 @@ func TestCmdBlenderFromEnvironment(t *testing.T) {
|
|||||||
envExe := `D:\Blender_3.2_stable\blender.exe`
|
envExe := `D:\Blender_3.2_stable\blender.exe`
|
||||||
|
|
||||||
err := os.Setenv(find_blender.BlenderPathEnvVariable, envExe)
|
err := os.Setenv(find_blender.BlenderPathEnvVariable, envExe)
|
||||||
if err != nil {
|
assert.NoError(t, err, "Could not set blender executable in environment")
|
||||||
t.Fatal("Could not set blender executable in environment variable")
|
|
||||||
}
|
|
||||||
|
|
||||||
taskID := "c5dfdfab-4492-4ab1-9b38-8ca4cbd84a17"
|
taskID := "c5dfdfab-4492-4ab1-9b38-8ca4cbd84a17"
|
||||||
cmd := api.Command{
|
cmd := api.Command{
|
||||||
|
Loading…
Reference in New Issue
Block a user
This should check that the environment variable isn't already set while running the test ;-)