/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: Canonical.com Patch Queue Manager
  • Date: 2007-04-01 06:48:38 UTC
  • mfrom: (2389.1.1 0.15-to-trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20070401064838-34903c7b0d0c8007
merge 0.15 back to dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
                          TestSuite,
50
50
                          TextTestRunner,
51
51
                          UnavailableFeature,
52
 
                          clean_selftest_output,
53
52
                          )
54
53
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
55
54
from bzrlib.tests.TestUtil import _load_module_by_name
1163
1162
        """The bzrlib hooks should be sanitised by setUp."""
1164
1163
        self.assertEqual(bzrlib.branch.BranchHooks(),
1165
1164
            bzrlib.branch.Branch.hooks)
1166
 
        self.assertEqual(bzrlib.smart.server.SmartServerHooks(),
1167
 
            bzrlib.smart.server.SmartTCPServer.hooks)
1168
1165
 
1169
1166
    def test__gather_lsprof_in_benchmarks(self):
1170
1167
        """When _gather_lsprof_in_benchmarks is on, accumulate profile data.
1397
1394
 
1398
1395
    def test_clean_output(self):
1399
1396
        # test functionality of clean_selftest_output()
1400
 
        self.build_tree(['test0000.tmp/', 'test0001.tmp/',
1401
 
                         'bzrlib/', 'tests/',
1402
 
                         'bzr', 'setup.py', 'test9999.tmp'])
 
1397
        from bzrlib.tests import clean_selftest_output
 
1398
 
 
1399
        dirs = ('test0000.tmp', 'test0001.tmp', 'bzrlib', 'tests')
 
1400
        files = ('bzr', 'setup.py', 'test9999.tmp')
 
1401
        for i in dirs:
 
1402
            os.mkdir(i)
 
1403
        for i in files:
 
1404
            f = file(i, 'wb')
 
1405
            f.write('content of ')
 
1406
            f.write(i)
 
1407
            f.close()
1403
1408
 
1404
1409
        root = os.getcwdu()
1405
1410
        before = os.listdir(root)
1415
1420
                           'test9999.tmp','tests'],
1416
1421
                           after)
1417
1422
 
1418
 
    def test_clean_readonly(self):
1419
 
        # test for delete read-only files
1420
 
        self.build_tree(['test0000.tmp/', 'test0000.tmp/foo'])
1421
 
        osutils.make_readonly('test0000.tmp/foo')
1422
 
        root = os.getcwdu()
1423
 
        before = os.listdir(root);  before.sort()
1424
 
        self.assertEquals(['test0000.tmp'], before)
1425
 
        clean_selftest_output(root, quiet=True)
1426
 
        after = os.listdir(root);   after.sort()
1427
 
        self.assertEquals([], after)
1428
 
 
1429
1423
 
1430
1424
class TestKnownFailure(TestCase):
1431
1425
 
1435
1429
        # runners.
1436
1430
        self.assertIsInstance(KnownFailure(""), AssertionError)
1437
1431
 
1438
 
    def test_expect_failure(self):
1439
 
        try:
1440
 
            self.expectFailure("Doomed to failure", self.assertTrue, False)
1441
 
        except KnownFailure, e:
1442
 
            self.assertEqual('Doomed to failure', e.args[0])
1443
 
        try:
1444
 
            self.expectFailure("Doomed to failure", self.assertTrue, True)
1445
 
        except AssertionError, e:
1446
 
            self.assertEqual('Unexpected success.  Should have failed:'
1447
 
                             ' Doomed to failure', e.args[0])
1448
 
        else:
1449
 
            self.fail('Assertion not raised')
1450
 
 
1451
1432
 
1452
1433
class TestFeature(TestCase):
1453
1434