~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: John Arbash Meinel
  • Date: 2006-08-23 23:21:12 UTC
  • mfrom: (1953 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1955.
  • Revision ID: john@arbash-meinel.com-20060823232112-f755378d583374a8
[merge] bzr.dev 1953

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
42
41
 
43
42
 
44
43
class SelftestTests(TestCase):
588
587
        output_string = output.getvalue()
589
588
        # if you are wondering about the regexp please read the comment in
590
589
        # test_bench_history (bzrlib.tests.test_selftest.TestRunner)
591
 
        # XXX: what comment?  -- Andrew Bennetts
592
 
        self.assertContainsRe(output_string, "--date [0-9.]+")
 
590
        self.assertContainsRe(output_string, "--date [0-9.]+ \S")
593
591
 
594
592
    def test_benchhistory_records_test_times(self):
595
593
        result_stream = StringIO()
707
705
        self.assertTrue(result.wasSuccessful())
708
706
 
709
707
    def test_bench_history(self):
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()
 
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.')
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.]+")
720
 
        if workingtree is not None:
721
 
            revision_id = workingtree.last_revision()
722
 
            self.assertEndsWith(output_string.rstrip(), revision_id)
 
719
        self.assertContainsRe(output_string, "--date [0-9.]+ \S")
 
720
        revision_id = branch.last_revision()
 
721
        self.assertEndsWith(output_string.rstrip(), revision_id)
723
722
 
724
723
 
725
724
class TestTestCase(TestCase):