~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: 2007-04-12 20:36:40 UTC
  • mfrom: (2413 +trunk)
  • mto: This revision was merged to the branch mainline in revision 2566.
  • Revision ID: john@arbash-meinel.com-20070412203640-z1jld315288moxvy
[merge] bzr.dev 2413

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,
52
53
                          )
53
54
from bzrlib.tests.test_sftp_transport import TestCaseWithSFTPServer
54
55
from bzrlib.tests.TestUtil import _load_module_by_name
1162
1163
        """The bzrlib hooks should be sanitised by setUp."""
1163
1164
        self.assertEqual(bzrlib.branch.BranchHooks(),
1164
1165
            bzrlib.branch.Branch.hooks)
 
1166
        self.assertEqual(bzrlib.smart.server.SmartServerHooks(),
 
1167
            bzrlib.smart.server.SmartTCPServer.hooks)
1165
1168
 
1166
1169
    def test__gather_lsprof_in_benchmarks(self):
1167
1170
        """When _gather_lsprof_in_benchmarks is on, accumulate profile data.
1394
1397
 
1395
1398
    def test_clean_output(self):
1396
1399
        # test functionality of clean_selftest_output()
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()
 
1400
        self.build_tree(['test0000.tmp/', 'test0001.tmp/',
 
1401
                         'bzrlib/', 'tests/',
 
1402
                         'bzr', 'setup.py', 'test9999.tmp'])
1408
1403
 
1409
1404
        root = os.getcwdu()
1410
1405
        before = os.listdir(root)
1420
1415
                           'test9999.tmp','tests'],
1421
1416
                           after)
1422
1417
 
 
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
 
1423
1429
 
1424
1430
class TestKnownFailure(TestCase):
1425
1431