Skip to content

Commit 2f1ef70

Browse files
authored
test: use errors.Is for comparing error (#356)
1 parent cad3959 commit 2f1ef70

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pkg/lockfile/parse-pylock_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package lockfile_test
22

33
import (
4+
"errors"
5+
"os"
46
"testing"
57

68
"github.com/g-rath/osv-detector/pkg/lockfile"
@@ -11,7 +13,9 @@ func TestParsePylock_FileDoesNotExist(t *testing.T) {
1113

1214
packages, err := lockfile.ParsePylock("testdata/pylock/does-not-exist")
1315

14-
expectErrContaining(t, err, "could not read")
16+
if !errors.Is(err, os.ErrNotExist) {
17+
t.Errorf("expected \"%v\" error but got \"%v\"", os.ErrNotExist, err)
18+
}
1519
expectPackages(t, packages, []lockfile.PackageDetails{})
1620
}
1721

0 commit comments

Comments
 (0)