Reviewers: mp+213397_code.launchpad.net,
Message: Please take a look.
Description: Isolate the bzr tests from the environment
The tests fail if the user running the tests has not told bzr who they are using 'bzr whoami'. This test isolates that behaviour.
https://code.launchpad.net/~thumper/juju-core/bzr-isolation/+merge/213397
(do not edit description out of merge proposal)
Please review this at https://codereview.appspot.com/82250045/
Affected files (+19, -0 lines): A [revision details] M bzr/bzr_test.go
Index: [revision details] === added file '[revision details]' --- [revision details] 2012-01-01 00:00:00 +0000 +++ [revision details] 2012-01-01 00:00:00 +0000 @@ -0,0 +1,2 @@ +Old revision: tarmac-20140330221944-tt65zj7hl6967aad +New revision: <email address hidden>
Index: bzr/bzr_test.go === modified file 'bzr/bzr_test.go' --- bzr/bzr_test.go 2013-08-19 11:17:19 +0000 +++ bzr/bzr_test.go 2014-03-31 01:56:29 +0000 @@ -4,13 +4,16 @@ package bzr_test
import ( + "io/ioutil" "os" "os/exec" + "path/filepath" "testing"
gc "launchpad.net/gocheck"
"launchpad.net/juju-core/bzr" + "launchpad.net/juju-core/testing/testbase" )
func Test(t *testing.T) { @@ -20,10 +23,24 @@ var _ = gc.Suite(&BzrSuite{})
type BzrSuite struct { + testbase.LoggingSuite b *bzr.Branch }
+const bzr_config = `[DEFAULT] +email = testing <email address hidden> +` + func (s *BzrSuite) SetUpTest(c *gc.C) { + s.LoggingSuite.SetUpTest(c) + bzrdir := c.MkDir() + s.PatchEnvironment("BZR_HOME", bzrdir) + err := os.Mkdir(filepath.Join(bzrdir, ".bazaar"), 0755) + c.Assert(err, gc.IsNil) + err = ioutil.WriteFile( + filepath.Join(bzrdir, ".bazaar", "bazaar.conf"), + []byte(bzr_config), 0644) + c.Assert(err, gc.IsNil) s.b = bzr.New(c.MkDir()) c.Assert(s.b.Init(), gc.IsNil) }
« Back to merge proposal
Reviewers: mp+213397_ code.launchpad. net,
Message:
Please take a look.
Description:
Isolate the bzr tests from the environment
The tests fail if the user running the tests has
not told bzr who they are using 'bzr whoami'. This
test isolates that behaviour.
https:/ /code.launchpad .net/~thumper/ juju-core/ bzr-isolation/ +merge/ 213397
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/82250045/
Affected files (+19, -0 lines):
A [revision details]
M bzr/bzr_test.go
Index: [revision details] 20140330221944- tt65zj7hl6967aa d
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-
+New revision: <email address hidden>
Index: bzr/bzr_test.go
=== modified file 'bzr/bzr_test.go'
--- bzr/bzr_test.go 2013-08-19 11:17:19 +0000
+++ bzr/bzr_test.go 2014-03-31 01:56:29 +0000
@@ -4,13 +4,16 @@
package bzr_test
import (
+ "io/ioutil"
"os"
"os/exec"
+ "path/filepath"
"testing"
gc "launchpad. net/gocheck"
"launchpad. net/juju- core/bzr" net/juju- core/testing/ testbase"
+ "launchpad.
)
func Test(t *testing.T) { &BzrSuite{ })
@@ -20,10 +23,24 @@
var _ = gc.Suite(
type BzrSuite struct { LoggingSuite
+ testbase.
b *bzr.Branch
}
+const bzr_config = `[DEFAULT] SetUpTest( c) ent("BZR_ HOME", bzrdir) filepath. Join(bzrdir, ".bazaar"), 0755) Join(bzrdir, ".bazaar", "bazaar.conf"), s.b.Init( ), gc.IsNil)
+email = testing <email address hidden>
+`
+
func (s *BzrSuite) SetUpTest(c *gc.C) {
+ s.LoggingSuite.
+ bzrdir := c.MkDir()
+ s.PatchEnvironm
+ err := os.Mkdir(
+ c.Assert(err, gc.IsNil)
+ err = ioutil.WriteFile(
+ filepath.
+ []byte(bzr_config), 0644)
+ c.Assert(err, gc.IsNil)
s.b = bzr.New(c.MkDir())
c.Assert(
}