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 dc48a713e6 - Show all commits

View File

@ -297,25 +297,13 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
// Test situation where file association with .blend files resulted in a blender executable. // Test situation where file association with .blend files resulted in a blender executable.
{ {
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{ savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir, StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{ BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable, IsUsable: true,
Input: &mockedPayload.Input, Input: "",
Path: &mockedPayload.Path, Path: "/path/to/blender",
Source: mockedPayload.Source, Source: api.BlenderPathSourceFileAssociation,
}, },
}) })
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath) assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
@ -332,24 +320,13 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
// Test situation where the given command could be found on $PATH. // Test situation where the given command could be found on $PATH.
{ {
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{ savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir, StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{ BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable, IsUsable: true,
Input: &mockedPayload.Input, Input: "kitty",
Path: &mockedPayload.Path, Path: "/path/to/kitty",
Source: mockedPayload.Source, Source: api.BlenderPathSourcePathEnvvar,
}, },
}) })
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath) assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
@ -366,24 +343,13 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
// Test a custom command given with the full path. // Test a custom command given with the full path.
{ {
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{ savedConfig := doTest(api.SetupAssistantConfig{
StorageLocation: mf.tempdir, StorageLocation: mf.tempdir,
BlenderExecutable: api.BlenderPathCheckResult{ BlenderExecutable: api.BlenderPathCheckResult{
IsUsable: &mockedPayload.IsUsable, IsUsable: true,
Input: &mockedPayload.Input, Input: "/bin/cat",
Path: &mockedPayload.Path, Path: "/bin/cat",
Source: mockedPayload.Source, Source: api.BlenderPathSourceInputPath,
}, },
}) })
assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath) assert.Equal(t, mf.tempdir, savedConfig.SharedStoragePath)
@ -397,34 +363,6 @@ func TestSaveSetupAssistantConfig(t *testing.T) {
assert.Equal(t, expectBlenderVar, savedConfig.Variables["blender"]) assert.Equal(t, expectBlenderVar, savedConfig.Variables["blender"])
assert.Equal(t, defaultBlenderArgsVar, savedConfig.Variables["blenderArgs"]) 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()) { func metaTestFixtures(t *testing.T) (mockedFlamenco, func()) {