~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2010-04-01 04:41:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5128.
  • Revision ID: mbp@sourcefrog.net-20100401044118-shyctqc02ob08ngz
ignore .testrepository

Show diffs side-by-side

added added

removed removed

Lines of Context:
472
472
        self.assertEqual("working tree is out of date, run 'bzr update'\n",
473
473
                         err)
474
474
 
475
 
    def test_status_on_ignored(self):
476
 
        """Tests branch status on an unversioned file which is considered ignored.
477
 
 
478
 
        See https://bugs.launchpad.net/bzr/+bug/40103
479
 
        """
480
 
        tree = self.make_branch_and_tree('.')
481
 
 
482
 
        self.build_tree(['test1.c', 'test1.c~', 'test2.c~'])
483
 
        result = self.run_bzr('status')[0]
484
 
        self.assertContainsRe(result, "unknown:\n  test1.c\n")
485
 
        short_result = self.run_bzr('status --short')[0]
486
 
        self.assertContainsRe(short_result, "\?   test1.c\n")
487
 
 
488
 
        result = self.run_bzr('status test1.c')[0]
489
 
        self.assertContainsRe(result, "unknown:\n  test1.c\n")
490
 
        short_result = self.run_bzr('status --short test1.c')[0]
491
 
        self.assertContainsRe(short_result, "\?   test1.c\n")
492
 
 
493
 
        result = self.run_bzr('status test1.c~')[0]
494
 
        self.assertContainsRe(result, "ignored:\n  test1.c~\n")
495
 
        short_result = self.run_bzr('status --short test1.c~')[0]
496
 
        self.assertContainsRe(short_result, "I   test1.c~\n")
497
 
 
498
 
        result = self.run_bzr('status test1.c~ test2.c~')[0]
499
 
        self.assertContainsRe(result, "ignored:\n  test1.c~\n  test2.c~\n")
500
 
        short_result = self.run_bzr('status --short test1.c~ test2.c~')[0]
501
 
        self.assertContainsRe(short_result, "I   test1.c~\nI   test2.c~\n")
502
 
 
503
 
        result = self.run_bzr('status test1.c test1.c~ test2.c~')[0]
504
 
        self.assertContainsRe(result, "unknown:\n  test1.c\nignored:\n  test1.c~\n  test2.c~\n")
505
 
        short_result = self.run_bzr('status --short test1.c test1.c~ test2.c~')[0]
506
 
        self.assertContainsRe(short_result, "\?   test1.c\nI   test1.c~\nI   test2.c~\n")
507
 
 
508
475
    def test_status_write_lock(self):
509
476
        """Test that status works without fetching history and
510
477
        having a write lock.
704
671
 
705
672
class TestStatusEncodings(TestCaseWithTransport):
706
673
 
 
674
    def setUp(self):
 
675
        TestCaseWithTransport.setUp(self)
 
676
        self.user_encoding = osutils._cached_user_encoding
 
677
        self.stdout = sys.stdout
 
678
 
 
679
    def tearDown(self):
 
680
        osutils._cached_user_encoding = self.user_encoding
 
681
        sys.stdout = self.stdout
 
682
        TestCaseWithTransport.tearDown(self)
 
683
 
707
684
    def make_uncommitted_tree(self):
708
685
        """Build a branch with uncommitted unicode named changes in the cwd."""
709
686
        working_tree = self.make_branch_and_tree(u'.')
717
694
        return working_tree
718
695
 
719
696
    def test_stdout_ascii(self):
720
 
        self.overrideAttr(osutils, '_cached_user_encoding', 'ascii')
 
697
        sys.stdout = StringIO()
 
698
        osutils._cached_user_encoding = 'ascii'
721
699
        working_tree = self.make_uncommitted_tree()
722
700
        stdout, stderr = self.run_bzr("status")
723
701
 
727
705
""")
728
706
 
729
707
    def test_stdout_latin1(self):
730
 
        self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
 
708
        sys.stdout = StringIO()
 
709
        osutils._cached_user_encoding = 'latin-1'
731
710
        working_tree = self.make_uncommitted_tree()
732
711
        stdout, stderr = self.run_bzr('status')
733
712