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
=== modified file 'testing/helpers.go'
--- testing/helpers.go 2014-02-06 11:20:21 +0000
+++ testing/helpers.go 2014-02-07 10:49:42 +0000
@@ -18,7 +18,9 @@
18package testing18package testing
1919
20import (20import (
21 "fmt"
21 "launchpad.net/ubuntu-push/logger"22 "launchpad.net/ubuntu-push/logger"
23 "os"
22 "path/filepath"24 "path/filepath"
23 "runtime"25 "runtime"
24 "strings"26 "strings"
@@ -102,5 +104,19 @@
102 if !ok {104 if !ok {
103 panic("failed to get source filename using Caller()")105 panic("failed to get source filename using Caller()")
104 }106 }
105 return filepath.Join(filepath.Dir(file), relativePath)107 dir := filepath.Dir(file)
108
109 root := os.Getenv("UBUNTU_PUSH_TEST_RESOURCES_ROOT")
110 if root != "" {
111 const sep = "launchpad.net/ubuntu-push/"
112
113 idx := strings.LastIndex(dir, sep)
114 if idx == -1 {
115 panic(fmt.Errorf("Unable to find %s in %#v", sep, dir))
116 }
117 idx += len(sep)
118
119 dir = filepath.Join(root, dir[idx:])
120 }
121 return filepath.Join(dir, relativePath)
106}122}

Subscribers

People subscribed via source and target branches