~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge updated set_parents api.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
from bzrlib.tests import (
23
23
                          TestCase,
24
24
                          TestCaseInTempDir,
 
25
                          TestCaseWithTransport,
25
26
                          TestSkipped,
26
27
                          )
27
28
from bzrlib.tests.blackbox import ExternalBase
77
78
            TestOptions.current_test = None
78
79
            TestCaseInTempDir.TEST_ROOT = old_root
79
80
 
80
 
    def test_benchmark_runs_benchmark_tests(self):
81
 
        """bzr selftest --benchmark should not run the default test suite."""
82
 
        # We test this by passing a regression test name to --benchmark, which
83
 
        # should result in 0 rests run.
84
 
        out, err = self.run_bzr('selftest', '--benchmark', 'workingtree_implementations')
85
 
        self.assertContainsRe(out, 'Ran 0 tests.*\n\nOK')
86
 
        self.assertEqual(
87
 
            'running tests...\ntests passed\n',
88
 
            err)
89
 
        
90
81
 
91
82
class TestRunBzr(ExternalBase):
92
83
 
105
96
        self.assertEqual('zippy', self.stdin)
106
97
 
107
98
 
 
99
class TestBenchmarkTests(TestCaseWithTransport):
 
100
 
 
101
    def test_benchmark_runs_benchmark_tests(self):
 
102
        """bzr selftest --benchmark should not run the default test suite."""
 
103
        # We test this by passing a regression test name to --benchmark, which
 
104
        # should result in 0 rests run.
 
105
        old_root = TestCaseInTempDir.TEST_ROOT
 
106
        try:
 
107
            TestCaseInTempDir.TEST_ROOT = None
 
108
            out, err = self.run_bzr('selftest', '--benchmark', 'workingtree_implementations')
 
109
        finally:
 
110
            TestCaseInTempDir.TEST_ROOT = old_root
 
111
        self.assertContainsRe(out, 'Ran 0 tests.*\n\nOK')
 
112
        self.assertEqual(
 
113
            'running tests...\ntests passed\n',
 
114
            err)
 
115
        benchfile = open(".perf_history", "rt")
 
116
        try:
 
117
            lines = benchfile.readlines()
 
118
        finally:
 
119
            benchfile.close()
 
120
        self.assertEqual(1, len(lines))
 
121
        self.assertContainsRe(lines[0], "--date [0-9.]+")
 
122
 
 
123
 
108
124
class TestRunBzrCaptured(ExternalBase):
109
125
 
110
126
    def apply_redirected(self, stdin=None, stdout=None, stderr=None,