Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: vpython/spec/load_test.go

Issue 2699223002: vpython: Add CIPD support. (Closed)
Patch Set: comments, path => name Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « vpython/cipd/cipd.go ('k') | vpython/spec/spec.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The LUCI Authors. All rights reserved. 1 // Copyright 2017 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package spec 5 package spec
6 6
7 import ( 7 import (
8 "path/filepath" 8 "path/filepath"
9 "strings" 9 "strings"
10 "testing" 10 "testing"
11 11
12 "github.com/luci/luci-go/common/testing/testfs" 12 "github.com/luci/luci-go/common/testing/testfs"
13 "github.com/luci/luci-go/vpython/api/vpython" 13 "github.com/luci/luci-go/vpython/api/vpython"
14 14
15 "github.com/golang/protobuf/proto" 15 "github.com/golang/protobuf/proto"
16 "golang.org/x/net/context" 16 "golang.org/x/net/context"
17 17
18 . "github.com/luci/luci-go/common/testing/assertions" 18 . "github.com/luci/luci-go/common/testing/assertions"
19 . "github.com/smartystreets/goconvey/convey" 19 . "github.com/smartystreets/goconvey/convey"
20 ) 20 )
21 21
22 func TestLoadForScript(t *testing.T) { 22 func TestLoadForScript(t *testing.T) {
23 t.Parallel() 23 t.Parallel()
24 24
25 goodSpec := &vpython.Spec{ 25 goodSpec := &vpython.Spec{
26 PythonVersion: "3.4.0", 26 PythonVersion: "3.4.0",
27 Wheel: []*vpython.Spec_Package{ 27 Wheel: []*vpython.Spec_Package{
28 » » » {Path: "foo/bar", Version: "1"}, 28 » » » {Name: "foo/bar", Version: "1"},
29 » » » {Path: "baz/qux", Version: "2"}, 29 » » » {Name: "baz/qux", Version: "2"},
30 }, 30 },
31 } 31 }
32 goodSpecData := proto.MarshalTextString(goodSpec) 32 goodSpecData := proto.MarshalTextString(goodSpec)
33 badSpecData := "foo: bar" 33 badSpecData := "foo: bar"
34 34
35 Convey(`Test LoadForScript`, t, testfs.MustWithTempDir(t, "TestLoadForSc ript", func(tdir string) { 35 Convey(`Test LoadForScript`, t, testfs.MustWithTempDir(t, "TestLoadForSc ript", func(tdir string) {
36 c := context.Background() 36 c := context.Background()
37 37
38 makePath := func(path string) string { 38 makePath := func(path string) string {
39 return filepath.Join(tdir, filepath.FromSlash(path)) 39 return filepath.Join(tdir, filepath.FromSlash(path))
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 "", 209 "",
210 "# Additional content...", 210 "# Additional content...",
211 }, "\n"), 211 }, "\n"),
212 }) 212 })
213 213
214 _, err := LoadForScript(c, makePath("pants.py"), false) 214 _, err := LoadForScript(c, makePath("pants.py"), false)
215 So(err, ShouldErrLike, "unterminated inline spec file") 215 So(err, ShouldErrLike, "unterminated inline spec file")
216 }) 216 })
217 })) 217 }))
218 } 218 }
OLDNEW
« no previous file with comments | « vpython/cipd/cipd.go ('k') | vpython/spec/spec.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698