~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.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:
1823
1823
    """Adapt the modules in mods_list using adapter and add to suite."""
1824
1824
    for test in iter_suite_tests(loader.loadTestsFromModuleNames(mods_list)):
1825
1825
        suite.addTests(adapter.adapt(test))
 
1826
 
 
1827
 
 
1828
def clean_selftest_output(root=None, quiet=False):
 
1829
    """Remove all selftest output directories from root directory.
 
1830
 
 
1831
    :param  root:   root directory for clean
 
1832
                    (if ommitted or None then clean current directory).
 
1833
    :param  quiet:  suppress report about deleting directories
 
1834
    """
 
1835
    import re
 
1836
    import shutil
 
1837
 
 
1838
    re_dir = re.compile(r'''test\d\d\d\d\.tmp''')
 
1839
    if root is None:
 
1840
        root = u'.'
 
1841
    for i in os.listdir(root):
 
1842
        if os.path.isdir(i) and re_dir.match(i):
 
1843
            if not quiet:
 
1844
                print 'delete directory:', i
 
1845
            shutil.rmtree(i)