~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Alexander Belchenko
  • Date: 2006-12-13 16:10:32 UTC
  • mto: This revision was merged to the branch mainline in revision 2185.
  • Revision ID: bialix@ukr.net-20061213161032-9u0fuuuebvk72j5w
Change name of option to '--clean-output' and provide tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
from bzrlib.errors import ParamikoNotPresent
28
28
from bzrlib.tests import (
29
29
                          TestCase,
 
30
                          TestCaseInTempDir,
30
31
                          TestCaseWithMemoryTransport,
31
32
                          TestCaseWithTransport,
32
33
                          TestSkipped,
451
452
 
452
453
        out, err = self.run_bzr_error(["bzr: ERROR: foobarbaz is not versioned"],
453
454
                                      'file-id', 'foobarbaz')
 
455
 
 
456
 
 
457
class TestSelftestCleanOutput(TestCaseInTempDir):
 
458
 
 
459
    def test_clean_output(self):
 
460
        # check that 'bzr selftest --clean-output' works correct
 
461
        dirs = ('test0000.tmp', 'test0001.tmp', 'bzrlib', 'tests')
 
462
        files = ('bzr', 'setup.py', 'test9999.tmp')
 
463
        for i in dirs:
 
464
            os.mkdir(i)
 
465
        for i in files:
 
466
            f = file(i, 'wb')
 
467
            f.write('content of ')
 
468
            f.write(i)
 
469
            f.close()
 
470
 
 
471
        root = os.getcwdu()
 
472
        before = os.listdir(root)
 
473
        self.assertEquals(['bzr','bzrlib','setup.py',
 
474
                           'test0000.tmp','test0001.tmp',
 
475
                           'test9999.tmp','tests'],
 
476
                           before)
 
477
 
 
478
        out,err = self.run_bzr_captured(['selftest','--clean-output'],
 
479
                                        working_dir=root)
 
480
 
 
481
        self.assertEquals('delete directory: test0000.tmp\n'
 
482
                          'delete directory: test0001.tmp\n',
 
483
                          out)
 
484
        self.assertEquals('', err)
 
485
 
 
486
        after = os.listdir(root)
 
487
        self.assertEquals(['bzr','bzrlib','setup.py',
 
488
                           'test9999.tmp','tests'],
 
489
                           after)