~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_clean_tree.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-11 15:04:23 UTC
  • mfrom: (5848.1.1 2.4-cython-first)
  • Revision ID: pqm@pqm.ubuntu.com-20110511150423-tpm1ablukqalkvim
(jameinel) Default to using Cython for compiling code,
 rather than Pyrex. (John A Meinel)

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