~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to tests/clean_tree.py

  • Committer: Aaron Bentley
  • Date: 2006-07-13 13:12:22 UTC
  • mfrom: (415.1.1 bzrtools)
  • Revision ID: abentley@panoramicfeedback.com-20060713131222-2bfdeff06434967b
clean-tree --detritus no longer implies --unknown

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
        assert os.path.exists('branch/die-please')
40
40
        os.mkdir('no-die-please/child')
41
41
 
42
 
        clean_tree('branch')
 
42
        clean_tree('branch', unknown=True)
43
43
        assert os.path.exists('no-die-please')
44
44
        assert os.path.exists('no-die-please/child')
45
45
 
53
53
        finally:
54
54
            f.close()
55
55
        file('branch/file.BASE', 'wb').write('contents')
56
 
        self.assertEqual(len(list(iter_deletables(tree))), 1)
 
56
        self.assertEqual(len(list(iter_deletables(tree, unknown=True))), 1)
 
57
        file('branch/file', 'wb').write('contents')
57
58
        file('branch/file~', 'wb').write('contents')
58
59
        file('branch/file.pyc', 'wb').write('contents')
59
 
        dels = [r for a,r in iter_deletables(tree)]
60
 
        assert 'file~' not in dels
61
 
        assert 'file.pyc' not in dels
 
60
 
 
61
        dels = sorted([r for a,r in iter_deletables(tree, unknown=True)])
 
62
        assert sorted(['file', 'file.BASE']) == dels
 
63
 
62
64
        dels = [r for a,r in iter_deletables(tree, detritus=True)]
63
 
        assert 'file~' in dels
64
 
        assert 'file.pyc' not in dels
 
65
        assert sorted(['file~', 'file.BASE']) == dels
 
66
 
65
67
        dels = [r for a,r in iter_deletables(tree, ignored=True)]
66
 
        assert 'file~' in dels
67
 
        assert 'file.BASE' in dels
68
 
        assert 'file.pyc' in dels
 
68
        assert sorted(['file~', 'file.pyc', '.bzrignore']) == dels
 
69
 
69
70
        dels = [r for a,r in iter_deletables(tree, unknown=False)]
70
 
        assert 'file.BASE' not in dels
 
71
        assert [] == dels
71
72
 
72
73
def test_suite():
73
74
    return makeSuite(TestCleanTree)