~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/test_commit.py

  • Committer: Robert Collins
  • Date: 2005-10-19 06:33:38 UTC
  • Revision ID: robertc@robertcollins.net-20051019063338-45b891502a09911c
The HTTP transport would return NoSuchFile inappropriately.

bzrlib.transport.http has been modified so that only 404 urllib errors
are returned as NoSuchFile. Other exceptions will propogate as normal.
This allows debuging of actual errors. (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import os
19
19
 
20
 
import bzrlib
21
20
from bzrlib.selftest import TestCaseInTempDir
22
21
from bzrlib.branch import Branch
23
22
from bzrlib.workingtree import WorkingTree
37
36
        return ['cat', '-']
38
37
 
39
38
 
40
 
class BranchWithHooks(BranchConfig):
41
 
 
42
 
    def post_commit(self):
43
 
        return "bzrlib.ahook bzrlib.ahook"
44
 
 
45
 
 
46
39
class TestCommit(TestCaseInTempDir):
47
40
 
48
41
    def test_simple_commit(self):
325
318
            self.failIf(branch.revision_store.has_id('B'))
326
319
        finally:
327
320
            bzrlib.gpg.GPGStrategy = oldstrategy
328
 
 
329
 
    def test_commit_invokes_hooks(self):
330
 
        import bzrlib.commit as commit
331
 
        branch = Branch.initialize('.')
332
 
        calls = []
333
 
        def called(branch, rev_id):
334
 
            calls.append('called')
335
 
        bzrlib.ahook = called
336
 
        try:
337
 
            config = BranchWithHooks(branch)
338
 
            commit.Commit(config=config).commit(
339
 
                            branch, "base",
340
 
                            allow_pointless=True,
341
 
                            rev_id='A')
342
 
            self.assertEqual(['called', 'called'], calls)
343
 
        finally:
344
 
            del bzrlib.ahook