/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_view.py

  • Committer: Vincent Ladeuil
  • Date: 2012-01-05 14:26:58 UTC
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120105142658-vek3v6pzlxb751s2
Tests passing for a first rough version of a cached branch config store. The changes here are too invasive and several parallel proposals have been made. 

@only_raises is evil and gave a hard time since any exception during
save_changes() was swallowed.

Possible improvements: 

- add some needs_write_lock decorators to crucial
  methods (_set_config_location ?) but keep locking the branch at higher levels

- decorate branch.unlock to call stack.save if last_lock() it True
  outside of @only_raises scope (evil decorator)

- add @needs_write_lock to stack.set and stack.remove (will probably get
  rid of most testing issues) we probably need a specialized decorator
  that can relay to the store and from there to the branch or whatever is
  needed. This will also helps bzr config to get it right. The
  get_mutable_section trick should not be needed anymore either.

- decorate branch.unlock to call stack.save if last_lock() it True outside
  of @only_raises scope (evil decorator)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
class TestViewUI(TestCaseWithTransport):
25
25
 
26
 
    def make_branch_and_tree(self):
27
 
        # we need to use a specific format because the default format
28
 
        # doesn't support views yet
29
 
        format = bzrdir.format_registry.make_bzrdir('development6-rich-root')
30
 
        return TestCaseWithTransport.make_branch_and_tree(self, '.',
31
 
            format=format)
32
 
 
33
26
    def test_view_command_help(self):
34
27
        out, err = self.run_bzr('help view')
35
28
        self.assertContainsRe(out, 'Manage filtered views')
36
29
 
37
30
    def test_define_view(self):
38
 
        wt = self.make_branch_and_tree()
 
31
        wt = self.make_branch_and_tree('.')
39
32
        # Check definition of a new view
40
33
        out, err = self.run_bzr('view a b c')
41
34
        self.assertEquals(out, "Using 'my' view: a, b, c\n")
51
44
        self.assertContainsRe(err, "Cannot change the 'off' pseudo view")
52
45
 
53
46
    def test_list_view(self):
54
 
        wt = self.make_branch_and_tree()
 
47
        wt = self.make_branch_and_tree('.')
55
48
        # Check list of the current view
56
49
        out, err = self.run_bzr('view')
57
50
        self.assertEquals(out, "No current view.\n")
76
69
        self.assertContainsRe(err, "No such view")
77
70
 
78
71
    def test_delete_view(self):
79
 
        wt = self.make_branch_and_tree()
 
72
        wt = self.make_branch_and_tree('.')
80
73
        # Check delete of the current view
81
74
        out, err = self.run_bzr('view --delete', retcode=3)
82
75
        self.assertContainsRe(err, "No current view to delete")
101
94
        self.assertContainsRe(err, "Both --delete and a file list specified")
102
95
 
103
96
    def test_switch_view(self):
104
 
        wt = self.make_branch_and_tree()
 
97
        wt = self.make_branch_and_tree('.')
105
98
        # Check switching to a named view
106
99
        self.run_bzr('view a b c')
107
100
        self.run_bzr('view e f --name foo')