~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_smart_request.py

  • Committer: Eric Siegerman
  • Date: 2009-03-25 18:48:15 UTC
  • mto: This revision was merged to the branch mainline in revision 4313.
  • Revision ID: pub08@davor.org-20090325184815-jni2cfu4ototu8lu
Don't generate HTML files for .txt's that are transcluded.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import threading
20
20
 
21
21
from bzrlib import errors
22
 
from bzrlib.bzrdir import BzrDir
23
22
from bzrlib.smart import request
24
23
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
25
24
from bzrlib.transport import get_transport
159
158
            ('NoSuchFile', 'path'), errors.NoSuchFile('path'))
160
159
 
161
160
    def test_LockContention(self):
162
 
        # For now, LockContentions are always transmitted with no details.
163
 
        # Eventually they should include a relpath or url or something else to
164
 
        # identify which lock is busy.
165
161
        self.assertTranslationEqual(
166
 
            ('LockContention',), errors.LockContention('lock', 'msg'))
 
162
            ('LockContention', 'lock', 'msg'),
 
163
            errors.LockContention('lock', 'msg'))
167
164
 
168
165
    def test_TokenMismatch(self):
169
166
        self.assertTranslationEqual(
201
198
        # A child of a transport in jail_info is allowed
202
199
        _pre_open_hook(t.clone('child'))
203
200
        # A parent is not allowed
204
 
        self.assertRaises(errors.JailBreak, _pre_open_hook, t.clone('..'))
 
201
        self.assertRaises(errors.BzrError, _pre_open_hook, t.clone('..'))
205
202
        # A completely unrelated transport is not allowed
206
203
        self.assertRaises(
207
 
            errors.JailBreak, _pre_open_hook, get_transport('http://host/'))
208
 
 
209
 
    def test_open_bzrdir_in_non_main_thread(self):
210
 
        """Opening a bzrdir in a non-main thread should work ok.
211
 
        
212
 
        This makes sure that the globally-installed
213
 
        bzrlib.smart.request._pre_open_hook, which uses a threading.local(),
214
 
        works in a newly created thread.
215
 
        """
216
 
        bzrdir = self.make_bzrdir('.')
217
 
        transport = bzrdir.root_transport
218
 
        thread_result = []
219
 
        def t():
220
 
            BzrDir.open_from_transport(transport)
221
 
            thread_result.append('ok')
222
 
        thread = threading.Thread(target=t)
223
 
        thread.start()
224
 
        thread.join()
225
 
        self.assertEqual(['ok'], thread_result)
 
204
            errors.BzrError, _pre_open_hook, get_transport('http://host/'))
226
205