~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-29 22:03:03 UTC
  • mfrom: (5416.2.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
(mbp) Add 'break-lock --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    conflicts,
34
34
    errors,
35
35
    osutils,
 
36
    status,
36
37
    )
37
38
import bzrlib.branch
38
39
from bzrlib.osutils import pathjoin
520
521
        out, err = self.run_bzr('status branch1 -rbranch:branch2')
521
522
        self.assertEqual('', out)
522
523
 
 
524
    def test_status_with_shelves(self):
 
525
        """Ensure that _show_shelve_summary handler works.
 
526
        """
 
527
        wt = self.make_branch_and_tree('.')
 
528
        self.build_tree(['hello.c'])
 
529
        wt.add('hello.c')
 
530
        self.run_bzr(['shelve', '--all', '-m', 'foo'])
 
531
        self.build_tree(['bye.c'])
 
532
        wt.add('bye.c')
 
533
        # As TestCase.setUp clears all hooks, we install this default
 
534
        # post_status hook handler for the test.
 
535
        status.hooks.install_named_hook('post_status',
 
536
            status._show_shelve_summary,
 
537
            'bzr status')
 
538
        self.assertStatus([
 
539
                'added:\n',
 
540
                '  bye.c\n',
 
541
                '1 shelves exist. See "bzr shelve --list" for details.\n',
 
542
            ],
 
543
            wt)
 
544
 
523
545
 
524
546
class CheckoutStatus(BranchStatus):
525
547
 
704
726
 
705
727
class TestStatusEncodings(TestCaseWithTransport):
706
728
 
707
 
    def setUp(self):
708
 
        TestCaseWithTransport.setUp(self)
709
 
        self.user_encoding = osutils._cached_user_encoding
710
 
        self.stdout = sys.stdout
711
 
 
712
 
    def tearDown(self):
713
 
        osutils._cached_user_encoding = self.user_encoding
714
 
        sys.stdout = self.stdout
715
 
        TestCaseWithTransport.tearDown(self)
716
 
 
717
729
    def make_uncommitted_tree(self):
718
730
        """Build a branch with uncommitted unicode named changes in the cwd."""
719
731
        working_tree = self.make_branch_and_tree(u'.')
727
739
        return working_tree
728
740
 
729
741
    def test_stdout_ascii(self):
730
 
        sys.stdout = StringIO()
731
 
        osutils._cached_user_encoding = 'ascii'
 
742
        self.overrideAttr(osutils, '_cached_user_encoding', 'ascii')
732
743
        working_tree = self.make_uncommitted_tree()
733
744
        stdout, stderr = self.run_bzr("status")
734
745
 
738
749
""")
739
750
 
740
751
    def test_stdout_latin1(self):
741
 
        sys.stdout = StringIO()
742
 
        osutils._cached_user_encoding = 'latin-1'
 
752
        self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
743
753
        working_tree = self.make_uncommitted_tree()
744
754
        stdout, stderr = self.run_bzr('status')
745
755