Merge lp:~chipaca/ubuntu-push/help-make-tests-pass-in-packaging into lp:ubuntu-push

Proposed by John Lenton
Status: Merged
Approved by: John Lenton
Approved revision: 58
Merged at revision: 58
Proposed branch: lp:~chipaca/ubuntu-push/help-make-tests-pass-in-packaging
Merge into: lp:ubuntu-push
Prerequisite: lp:~chipaca/ubuntu-push/chamera-orchestra
Diff against target: 34 lines (+17/-1)
1 file modified
testing/helpers.go (+17/-1)
To merge this branch: bzr merge lp:~chipaca/ubuntu-push/help-make-tests-pass-in-packaging
Reviewer Review Type Date Requested Status
Samuele Pedroni Approve
Review via email: mp+205331@code.launchpad.net

Commit message

made GetSourceRelative look at the environ to help make the tests pass in packaging

Description of the change

made GetSourceRelative look at the environ to help make the tests pass in packaging

To post a comment you must log in.
Revision history for this message
Samuele Pedroni (pedronis) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'testing/helpers.go'
2--- testing/helpers.go 2014-02-06 11:20:21 +0000
3+++ testing/helpers.go 2014-02-07 10:49:42 +0000
4@@ -18,7 +18,9 @@
5 package testing
6
7 import (
8+ "fmt"
9 "launchpad.net/ubuntu-push/logger"
10+ "os"
11 "path/filepath"
12 "runtime"
13 "strings"
14@@ -102,5 +104,19 @@
15 if !ok {
16 panic("failed to get source filename using Caller()")
17 }
18- return filepath.Join(filepath.Dir(file), relativePath)
19+ dir := filepath.Dir(file)
20+
21+ root := os.Getenv("UBUNTU_PUSH_TEST_RESOURCES_ROOT")
22+ if root != "" {
23+ const sep = "launchpad.net/ubuntu-push/"
24+
25+ idx := strings.LastIndex(dir, sep)
26+ if idx == -1 {
27+ panic(fmt.Errorf("Unable to find %s in %#v", sep, dir))
28+ }
29+ idx += len(sep)
30+
31+ dir = filepath.Join(root, dir[idx:])
32+ }
33+ return filepath.Join(dir, relativePath)
34 }

Subscribers

People subscribed via source and target branches