~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_clean_tree.py

  • Committer: Patch Queue Manager
  • Date: 2013-10-07 17:04:34 UTC
  • mfrom: (6588.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20131007170434-mb0ahksmrzsnhi1i
(vila) Stricter checks on configuration option names (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
import shutil
21
21
import sys
22
 
import types
23
22
 
24
23
from bzrlib import tests, ui
25
 
from bzrlib.bzrdir import (
26
 
    BzrDir,
 
24
from bzrlib.controldir import (
 
25
    ControlDir,
27
26
    )
28
27
from bzrlib.clean_tree import (
29
28
    clean_tree,
43
42
        if has_symlinks() is False:
44
43
            return
45
44
        os.mkdir('branch')
46
 
        BzrDir.create_standalone_workingtree('branch')
 
45
        ControlDir.create_standalone_workingtree('branch')
47
46
        os.symlink(os.path.realpath('no-die-please'), 'branch/die-please')
48
47
        os.mkdir('no-die-please')
49
 
        self.failUnlessExists('branch/die-please')
 
48
        self.assertPathExists('branch/die-please')
50
49
        os.mkdir('no-die-please/child')
51
50
 
52
51
        clean_tree('branch', unknown=True, no_prompt=True)
53
 
        self.failUnlessExists('no-die-please')
54
 
        self.failUnlessExists('no-die-please/child')
 
52
        self.assertPathExists('no-die-please')
 
53
        self.assertPathExists('no-die-please/child')
55
54
 
56
55
    def test_iter_deletable(self):
57
56
        """Files are selected for deletion appropriately"""
58
57
        os.mkdir('branch')
59
 
        tree = BzrDir.create_standalone_workingtree('branch')
 
58
        tree = ControlDir.create_standalone_workingtree('branch')
60
59
        transport = tree.bzrdir.root_transport
61
60
        transport.put_bytes('.bzrignore', '*~\n*.pyc\n.bzrignore\n')
62
61
        transport.put_bytes('file.BASE', 'contents')
98
97
        def _dummy_rmtree(path, ignore_errors=False, onerror=None):
99
98
            """Call user supplied error handler onerror.
100
99
            """
101
 
            self.assertTrue(isinstance(onerror, types.FunctionType))
102
100
            # Indicate failure in removing 'path' if path is subdir0
103
101
            # We later check to ensure that this is indicated
104
102
            # to the user as a warning. We raise OSError to construct
123
121
        stderr = tests.StringIOWrapper()
124
122
        ui.ui_factory = tests.TestUIFactory(stdout=stdout, stderr=stderr)
125
123
 
126
 
        BzrDir.create_standalone_workingtree('.')
 
124
        ControlDir.create_standalone_workingtree('.')
127
125
        self.build_tree(['0foo', '1bar', '2baz', 'subdir0/'])
128
126
        clean_tree('.', unknown=True, no_prompt=True)
129
127
        self.assertContainsRe(stderr.getvalue(),