~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-12-14 18:28:35 UTC
  • mfrom: (2172.4.5 selftest.cleanup)
  • Revision ID: pqm@pqm.ubuntu.com-20061214182835-a7d577cca2b16908
(bialix) 'bzr selftest --clean-output' remove tests temp directories
 without running tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1839
1839
    """Adapt the modules in mods_list using adapter and add to suite."""
1840
1840
    for test in iter_suite_tests(loader.loadTestsFromModuleNames(mods_list)):
1841
1841
        suite.addTests(adapter.adapt(test))
 
1842
 
 
1843
 
 
1844
def clean_selftest_output(root=None, quiet=False):
 
1845
    """Remove all selftest output directories from root directory.
 
1846
 
 
1847
    :param  root:   root directory for clean
 
1848
                    (if ommitted or None then clean current directory).
 
1849
    :param  quiet:  suppress report about deleting directories
 
1850
    """
 
1851
    import re
 
1852
    import shutil
 
1853
 
 
1854
    re_dir = re.compile(r'''test\d\d\d\d\.tmp''')
 
1855
    if root is None:
 
1856
        root = u'.'
 
1857
    for i in os.listdir(root):
 
1858
        if os.path.isdir(i) and re_dir.match(i):
 
1859
            if not quiet:
 
1860
                print 'delete directory:', i
 
1861
            shutil.rmtree(i)