/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/test_selftest.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-23 22:42:38 UTC
  • mfrom: (1951.1.2 test tweaks)
  • mto: This revision was merged to the branch mainline in revision 1954.
  • Revision ID: john@arbash-meinel.com-20060823224238-89bbd75611a4eef9
[merge] Andrew Bennetts: update test_bench_history

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
import bzrlib.errors as errors
39
39
from bzrlib import symbol_versioning
40
40
from bzrlib.trace import note
 
41
from bzrlib.version import _get_bzr_source_tree
41
42
 
42
43
 
43
44
class SelftestTests(TestCase):
587
588
        output_string = output.getvalue()
588
589
        # if you are wondering about the regexp please read the comment in
589
590
        # test_bench_history (bzrlib.tests.test_selftest.TestRunner)
590
 
        self.assertContainsRe(output_string, "--date [0-9.]+ \S")
 
591
        # XXX: what comment?  -- Andrew Bennetts
 
592
        self.assertContainsRe(output_string, "--date [0-9.]+")
591
593
 
592
594
    def test_benchhistory_records_test_times(self):
593
595
        result_stream = StringIO()
705
707
        self.assertTrue(result.wasSuccessful())
706
708
 
707
709
    def test_bench_history(self):
708
 
        import bzrlib.branch
709
 
        try:
710
 
            branch = bzrlib.branch.Branch.open_containing(__file__)[0]
711
 
        except errors.NotBranchError:
712
 
            raise TestSkipped(
713
 
                'Test must be run in a bzr.dev tree, not an installed copy.')
 
710
        # tests that the running the benchmark produces a history file
 
711
        # containing a timestamp and the revision id of the bzrlib source which
 
712
        # was tested.
 
713
        workingtree = _get_bzr_source_tree()
714
714
        test = TestRunner('dummy_test')
715
715
        output = StringIO()
716
716
        runner = TextTestRunner(stream=self._log_file, bench_history=output)
717
717
        result = self.run_test_runner(runner, test)
718
718
        output_string = output.getvalue()
719
 
        self.assertContainsRe(output_string, "--date [0-9.]+ \S")
720
 
        revision_id = branch.last_revision()
721
 
        self.assertEndsWith(output_string.rstrip(), revision_id)
 
719
        self.assertContainsRe(output_string, "--date [0-9.]+")
 
720
        if workingtree is not None:
 
721
            revision_id = workingtree.last_revision()
 
722
            self.assertEndsWith(output_string.rstrip(), revision_id)
722
723
 
723
724
 
724
725
class TestTestCase(TestCase):