~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_init.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-20 08:03:24 UTC
  • mfrom: (1662.1.19 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060420080324-8acbffaeefd8f243
(mbp) better error messages from bzr init

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
"""Test "bzr init"""
19
19
 
20
20
import os
 
21
import re
21
22
 
22
23
from bzrlib.bzrdir import BzrDirMetaFormat1
23
24
from bzrlib.tests.blackbox import ExternalBase
81
82
        out, err = self.run_bzr('init', 'subdir2', retcode=3)
82
83
        self.assertEqual('', out)
83
84
        self.failUnless(err.startswith('bzr: ERROR: Already a branch:'))
 
85
 
 
86
    def test_init_existing_branch(self):
 
87
        self.run_bzr('init')
 
88
        out, err = self.run_bzr('init', retcode=3)
 
89
        self.assertContainsRe(err, 'Already a branch')
 
90
        # don't suggest making a checkout, there's already a working tree
 
91
        self.assertFalse(re.search(r'checkout', err))
 
92
 
 
93
    def test_init_existing_without_workingtree(self):
 
94
        # make a repository
 
95
        self.run_bzr('init-repo', '.')
 
96
        # make a branch; by default without a working tree
 
97
        self.run_bzr('init', 'subdir')
 
98
        # fail
 
99
        out, err = self.run_bzr('init', 'subdir', retcode=3)
 
100
        # suggests using checkout
 
101
        self.assertContainsRe(err, 'ontains a branch.*but no working tree.*checkout')
 
102