Manager: allow setup to finish without Blender #104306

Manually merged
Sybren A. Stüvel merged 34 commits from abelli/flamenco:issue100195 into main 2024-09-09 11:22:42 +02:00
Showing only changes of commit 50d113db4f - Show all commits

View File

@ -297,13 +297,25 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
// Test situation where file association with .blend files resulted in a blender executable.
{
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
mockedPayload := struct {
IsUsable bool
Input string
Path string
Source api.BlenderPathSource
}{
IsUsable: true,
Input: "",
Path: "/path/to/blender",
Source: api.BlenderPathSourceFileAssociation,
}
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable,
Input: &mockedPayload.Input,
Path: &mockedPayload.Path,
Source: mockedPayload.Source,
},
})
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
@ -320,13 +332,24 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
// Test situation where the given command could be found on $PATH.
{
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
mockedPayload := struct {
IsUsable bool
Input string
Path string
Source api.BlenderPathSource
}{
IsUsable: true,
Input: "kitty",
Path: "/path/to/kitty",
Source: api.BlenderPathSourcePathEnvvar,
}
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable,
Input: &mockedPayload.Input,
Path: &mockedPayload.Path,
Source: mockedPayload.Source,
},
})
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
@ -343,13 +366,24 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
// Test a custom command given with the full path.
{
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
mockedPayload := struct {
IsUsable bool
Input string
Path string
Source api.BlenderPathSource
}{
IsUsable: true,
Input: "/bin/cat",
Path: "/bin/cat",
Source: api.BlenderPathSourceInputPath,
}
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable,
Input: &mockedPayload.Input,
Path: &mockedPayload.Path,
Source: mockedPayload.Source,
},
})
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
@ -363,6 +397,34 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
assert.Equal(t, expectBlenderVar, savedConfig.Variables["blender"])
assert.Equal(t, defaultBlenderArgsVar, savedConfig.Variables["blenderArgs"])
}
// Test situation where adding a blender executable was skipped.
{
mockedPayload := struct {
IsUsable bool
Source api.BlenderPathSource
}{
IsUsable: true,
Source: api.BlenderPathSourceDefault,
}
savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable,
Source: mockedPayload.Source,
},
})
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
expectBlenderVar := config.Variable{
Values: config.VariableValues{
{Platform: "linux", Value: "blender"},
{Platform: "windows", Value: "blender"},
{Platform: "darwin", Value: "blender"},
},
}
assert.Equal(t, expectBlenderVar, savedConfig.Variables["blender"])
assert.Equal(t, defaultBlenderArgsVar, savedConfig.Variables["blenderArgs"])
}
}
func metaTestFixtures(t *testing.T) (mockedFlamenco, func()) {