~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/test_lp_open.py

  • Committer: Vincent Ladeuil
  • Date: 2009-12-08 10:04:18 UTC
  • mto: (4875.1.1 integration2)
  • mto: This revision was merged to the branch mainline in revision 4876.
  • Revision ID: v.ladeuil+lp@free.fr-20091208100418-zhsj8gqek33br1co
Fixed as per John's hawk eye review.

* bzrlib/plugins/launchpad/test_lp_open.py:
(TestLaunchpadOpen.run_open): Add a working_dir parameter for
run_bzr to avoid os.chdir() calls.
(TestLaunchpadOpen.test_launchpad_branch_subdirectory): Avoid
os.chdir() call.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
"""Tests for the launchpad-open command."""
18
18
 
19
19
from bzrlib.tests import TestCaseWithTransport
20
 
import os
21
20
 
22
21
 
23
22
class TestLaunchpadOpen(TestCaseWithTransport):
24
23
 
25
 
    def run_open(self, location, retcode=0):
26
 
        out, err = self.run_bzr(
27
 
            ['launchpad-open', '--dry-run', location], retcode=retcode)
 
24
    def run_open(self, location, retcode=0, working_dir='.'):
 
25
        out, err = self.run_bzr(['launchpad-open', '--dry-run', location],
 
26
                                retcode=retcode,
 
27
                                working_dir=working_dir)
28
28
        return err.splitlines()
29
29
 
30
30
    def test_non_branch(self):
95
95
        wt.branch.set_push_location(
96
96
            'bzr+ssh://bazaar.launchpad.net/~foo/bar/baz')
97
97
        self.build_tree(['lp/a/'])
98
 
        os.chdir('lp/a')
99
98
        self.assertEqual(
100
99
            ['Opening https://code.edge.launchpad.net/~foo/bar/baz in web '
101
100
             'browser'],
102
 
            self.run_open('.'))
 
101
            self.run_open('.', working_dir='lp/a'))