~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_selftest.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-12 00:59:53 UTC
  • mfrom: (2379.6.4 selftest.win32)
  • Revision ID: pqm@pqm.ubuntu.com-20070412005953-vow66znisuxhrauk
(bialix,r=john) win32-related selftest improvements

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
1396
1397
 
1397
1398
    def test_clean_output(self):
1398
1399
        # test functionality of clean_selftest_output()
1399
 
        from bzrlib.tests import clean_selftest_output
1400
 
 
1401
 
        dirs = ('test0000.tmp', 'test0001.tmp', 'bzrlib', 'tests')
1402
 
        files = ('bzr', 'setup.py', 'test9999.tmp')
1403
 
        for i in dirs:
1404
 
            os.mkdir(i)
1405
 
        for i in files:
1406
 
            f = file(i, 'wb')
1407
 
            f.write('content of ')
1408
 
            f.write(i)
1409
 
            f.close()
 
1400
        self.build_tree(['test0000.tmp/', 'test0001.tmp/',
 
1401
                         'bzrlib/', 'tests/',
 
1402
                         'bzr', 'setup.py', 'test9999.tmp'])
1410
1403
 
1411
1404
        root = os.getcwdu()
1412
1405
        before = os.listdir(root)
1422
1415
                           'test9999.tmp','tests'],
1423
1416
                           after)
1424
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
 
1425
1429
 
1426
1430
class TestKnownFailure(TestCase):
1427
1431