/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

(gz) Check committer values are ascii or unicode and fix a test where it was
 not (Martin [gz])

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
44
45
 
45
46
class BranchStatus(TestCaseWithTransport):
46
47
 
 
48
    def setUp(self):
 
49
        super(BranchStatus, self).setUp()
 
50
        # As TestCase.setUp clears all hooks, we install this default
 
51
        # post_status hook handler for the test.
 
52
        status.hooks.install_named_hook('post_status',
 
53
            status._show_shelve_summary,
 
54
            'bzr status')
 
55
 
47
56
    def assertStatus(self, expected_lines, working_tree,
48
57
        revision=None, short=False, pending=True, verbose=False):
49
58
        """Run status in working_tree and look for output.
520
529
        out, err = self.run_bzr('status branch1 -rbranch:branch2')
521
530
        self.assertEqual('', out)
522
531
 
 
532
    def test_status_with_shelves(self):
 
533
        """Ensure that _show_shelve_summary handler works.
 
534
        """
 
535
        wt = self.make_branch_and_tree('.')
 
536
        self.build_tree(['hello.c'])
 
537
        wt.add('hello.c')
 
538
        self.run_bzr(['shelve', '--all', '-m', 'foo'])
 
539
        self.build_tree(['bye.c'])
 
540
        wt.add('bye.c')
 
541
        self.assertStatus([
 
542
                'added:\n',
 
543
                '  bye.c\n',
 
544
                '1 shelves exist. See "bzr shelve --list" for details.\n',
 
545
            ],
 
546
            wt)
 
547
 
523
548
 
524
549
class CheckoutStatus(BranchStatus):
525
550
 
704
729
 
705
730
class TestStatusEncodings(TestCaseWithTransport):
706
731
 
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
732
    def make_uncommitted_tree(self):
718
733
        """Build a branch with uncommitted unicode named changes in the cwd."""
719
734
        working_tree = self.make_branch_and_tree(u'.')
727
742
        return working_tree
728
743
 
729
744
    def test_stdout_ascii(self):
730
 
        sys.stdout = StringIO()
731
 
        osutils._cached_user_encoding = 'ascii'
 
745
        self.overrideAttr(osutils, '_cached_user_encoding', 'ascii')
732
746
        working_tree = self.make_uncommitted_tree()
733
747
        stdout, stderr = self.run_bzr("status")
734
748
 
738
752
""")
739
753
 
740
754
    def test_stdout_latin1(self):
741
 
        sys.stdout = StringIO()
742
 
        osutils._cached_user_encoding = 'latin-1'
 
755
        self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
743
756
        working_tree = self.make_uncommitted_tree()
744
757
        stdout, stderr = self.run_bzr('status')
745
758