Worker: add test flag to enable Blender-dependent test
Add a `-withBlender` CLI argument for a unit test, to aid in debugging T99438. Run the test with `go test ./internal/worker/find_blender/ -args -withBlender` to actually fail when the file association with `.blend` files cannot be found. Note that this doesn't rely on Blender being runnable, but it does rely on _something_ being associated with .blend files.
This commit is contained in:
parent
60971722fc
commit
2965856aa3
@ -4,17 +4,24 @@
|
|||||||
package find_blender
|
package find_blender
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"flag"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var withBlender = flag.Bool("withBlender", false, "run test that requires Blender to be installed")
|
||||||
|
|
||||||
// TestFindBlender is a "weak" test, which actually accepts both happy and unhappy flows.
|
// TestFindBlender is a "weak" test, which actually accepts both happy and unhappy flows.
|
||||||
// It would be too fragile to always require a file association to be set up with Blender.
|
// It would be too fragile to always require a file association to be set up with Blender.
|
||||||
func TestFindBlender(t *testing.T) {
|
func TestFindBlender(t *testing.T) {
|
||||||
exe, err := FindBlender()
|
exe, err := FindBlender()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
assert.Empty(t, exe)
|
assert.Empty(t, exe)
|
||||||
|
|
||||||
|
if *withBlender {
|
||||||
|
t.Fatalf("unexpected error: %v", err)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
assert.NotEmpty(t, exe)
|
assert.NotEmpty(t, exe)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user