171
174
def test_benchmark_runs_benchmark_tests(self):
172
175
"""bzr selftest --benchmark should not run the default test suite."""
173
176
# We test this by passing a regression test name to --benchmark, which
174
# should result in 0 tests run.
177
# should result in 0 rests run.
175
178
old_root = TestCaseWithMemoryTransport.TEST_ROOT
177
180
TestCaseWithMemoryTransport.TEST_ROOT = None
257
260
class TestRunBzrSubprocess(TestCaseWithTransport):
259
262
def test_run_bzr_subprocess(self):
260
"""The run_bzr_helper_external command behaves nicely."""
263
"""The run_bzr_helper_external comand behaves nicely."""
261
264
result = self.run_bzr_subprocess('--version')
262
265
result = self.run_bzr_subprocess(['--version'])
263
266
result = self.run_bzr_subprocess('--version', retcode=None)
271
274
'magic merge'], retcode=3)[1]
272
275
self.assertContainsRe(err, 'Bad value "magic merge" for option'
277
self.callDeprecated(['passing varargs to run_bzr_subprocess was'
278
' deprecated in version 0.91.'],
279
self.run_bzr_subprocess,
280
'arg1', 'arg2', 'arg3', retcode=3)
275
282
def test_run_bzr_subprocess_env(self):
276
283
"""run_bzr_subprocess can set environment variables in the child only.
551
558
out_rand2.splitlines(), 2)
552
559
self.assertEqual(tests_rand, tests_rand2)
555
class TestSelftestWithIdList(TestCaseInTempDir):
557
def test_load_list(self):
558
# We don't want to call selftest for the whole suite, so we start with
560
test_list_fname = 'test.list'
561
fl = open(test_list_fname, 'wt')
562
fl.write('%s\n' % self.id())
564
out, err = self.run_bzr(
565
['selftest', '--load-list', test_list_fname, '--list'])
566
self.assertContainsRe(out, "Listed 1 test in")
568
def test_load_unknown(self):
569
out, err = self.run_bzr('selftest --load-list I_do_not_exist ',
573
class TestSelftestStartingWith(TestCase):
575
def test_starting_with_single_argument(self):
576
out, err = self.run_bzr(
577
['selftest', '--starting-with', self.id(), '--list'])
578
self.assertContainsRe(out, "Listed 1 test in")
579
self.assertContainsRe(out, self.id())
581
def test_starting_with_multiple_argument(self):
582
out, err = self.run_bzr(
584
'--starting-with', self.id(),
585
'--starting-with', 'bzrlib.tests.test_sampler',
587
self.assertContainsRe(out, "Listed 2 tests in")
588
self.assertContainsRe(out, self.id())
589
self.assertContainsRe(out, 'bzrlib.tests.test_sampler')