From 9df51661d98c9b4c73d00cd4436870c6a80ca165 Mon Sep 17 00:00:00 2001 From: Gordon Date: Wed, 6 Mar 2024 14:51:03 -0500 Subject: [PATCH] Skip test instead of fail if pylsp is not found --- pkg/code/lsp.go | 3 +++ pkg/code/python/python_test.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/pkg/code/lsp.go b/pkg/code/lsp.go index fa4f138c5..f972642c2 100644 --- a/pkg/code/lsp.go +++ b/pkg/code/lsp.go @@ -32,6 +32,9 @@ func NewLSP(ctx context.Context, lspCmd string, cmdStderr io.Writer) (*LSP, erro log := zap.L().Named(fmt.Sprintf("lsp/%s", lspCmd)) cmd := exec.CommandContext(ctx, lspCmd, "-vv") + if cmd.Err != nil { + return nil, fmt.Errorf("failed to create command: %w", cmd.Err) + } send, err := cmd.StdinPipe() if err != nil { return nil, fmt.Errorf("failed to create stdin pipe: %w", err) diff --git a/pkg/code/python/python_test.go b/pkg/code/python/python_test.go index ee2693768..a8e4fd97b 100644 --- a/pkg/code/python/python_test.go +++ b/pkg/code/python/python_test.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "os/exec" "path/filepath" "strings" "testing" @@ -103,6 +104,9 @@ func (tc testCase) TestConstraints(t *testing.T, input []byte) { "test.py": &fstest.MapFile{Data: input}, } actual, err := FindBoto3Constraints(context.Background(), files) + if errors.Is(err, exec.ErrNotFound) { + t.Skip("pylsp not found") + } if err != nil { t.Fatal(err) }