| OLD | NEW |
| 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 venv | 5 package venv |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "fmt" | 9 "fmt" |
| 10 "io/ioutil" | 10 "io/ioutil" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if err != nil { | 133 if err != nil { |
| 134 t.Fatalf("could not set up test loader for %q: %s", ri.py.Python
, err) | 134 t.Fatalf("could not set up test loader for %q: %s", ri.py.Python
, err) |
| 135 } | 135 } |
| 136 | 136 |
| 137 Convey(`Testing Setup`, t, testfs.MustWithTempDir(t, "vpython", func(tdi
r string) { | 137 Convey(`Testing Setup`, t, testfs.MustWithTempDir(t, "vpython", func(tdi
r string) { |
| 138 c := context.Background() | 138 c := context.Background() |
| 139 config := Config{ | 139 config := Config{ |
| 140 BaseDir: tdir, | 140 BaseDir: tdir, |
| 141 MaxHashLen: 4, | 141 MaxHashLen: 4, |
| 142 Package: vpython.Spec_Package{ | 142 Package: vpython.Spec_Package{ |
| 143 » » » » Path: "foo/bar/virtualenv", | 143 » » » » Name: "foo/bar/virtualenv", |
| 144 Version: "unresolved", | 144 Version: "unresolved", |
| 145 }, | 145 }, |
| 146 Python: ri.py.Python, | 146 Python: ri.py.Python, |
| 147 Spec: &vpython.Spec{ | 147 Spec: &vpython.Spec{ |
| 148 Wheel: []*vpython.Spec_Package{ | 148 Wheel: []*vpython.Spec_Package{ |
| 149 » » » » » {Path: "foo/bar/shirt", Version: "unreso
lved"}, | 149 » » » » » {Name: "foo/bar/shirt", Version: "unreso
lved"}, |
| 150 » » » » » {Path: "foo/bar/pants", Version: "unreso
lved"}, | 150 » » » » » {Name: "foo/bar/pants", Version: "unreso
lved"}, |
| 151 }, | 151 }, |
| 152 }, | 152 }, |
| 153 Loader: tl, | 153 Loader: tl, |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Load the bootstrap wheels for the next part of the test. | 156 // Load the bootstrap wheels for the next part of the test. |
| 157 So(tl.ensureWheels(c, t, ri.py, tdir), ShouldBeNil) | 157 So(tl.ensureWheels(c, t, ri.py, tdir), ShouldBeNil) |
| 158 | 158 |
| 159 err := With(c, config, false, func(c context.Context, v *Env) er
ror { | 159 err := With(c, config, false, func(c context.Context, v *Env) er
ror { |
| 160 testScriptPath := filepath.Join(testDataDir, "setup_chec
k.py") | 160 testScriptPath := filepath.Join(testDataDir, "setup_chec
k.py") |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 func loadJSON(path string, dst interface{}) error { | 197 func loadJSON(path string, dst interface{}) error { |
| 198 content, err := ioutil.ReadFile(path) | 198 content, err := ioutil.ReadFile(path) |
| 199 if err != nil { | 199 if err != nil { |
| 200 return errors.Annotate(err).Reason("failed to open file").Err() | 200 return errors.Annotate(err).Reason("failed to open file").Err() |
| 201 } | 201 } |
| 202 if err := json.Unmarshal(content, dst); err != nil { | 202 if err := json.Unmarshal(content, dst); err != nil { |
| 203 return errors.Annotate(err).Reason("failed to unmarshal JSON").E
rr() | 203 return errors.Annotate(err).Reason("failed to unmarshal JSON").E
rr() |
| 204 } | 204 } |
| 205 return nil | 205 return nil |
| 206 } | 206 } |
| OLD | NEW |