~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_clean_tree.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

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