~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/__init__.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-02-22 07:59:56 UTC
  • mfrom: (1553.5.33 bzr.mbp.locks)
  • Revision ID: pqm@pqm.ubuntu.com-20060222075956-fb281c427e571da6
add LockDir and related fixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005, 2006 by 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
42
42
import bzrlib.errors as errors
43
43
import bzrlib.inventory
44
44
import bzrlib.iterablefile
 
45
import bzrlib.lockdir
45
46
import bzrlib.merge3
46
47
import bzrlib.osutils
47
48
import bzrlib.osutils as osutils
48
49
import bzrlib.plugin
49
50
import bzrlib.store
50
51
import bzrlib.trace
51
 
from bzrlib.transport import urlescape
 
52
from bzrlib.transport import urlescape, get_transport
52
53
import bzrlib.transport
53
54
from bzrlib.transport.local import LocalRelpathServer
54
55
from bzrlib.transport.readonly import ReadonlyServer
66
67
                      bzrlib.errors,
67
68
                      bzrlib.inventory,
68
69
                      bzrlib.iterablefile,
 
70
                      bzrlib.lockdir,
69
71
                      bzrlib.merge3,
70
72
                      bzrlib.option,
71
73
                      bzrlib.osutils,
299
301
            raise AssertionError('pattern "%s" not found in "%s"'
300
302
                    % (needle_re, haystack))
301
303
 
302
 
    def AssertSubset(self, sublist, superlist):
 
304
    def assertSubset(self, sublist, superlist):
303
305
        """Assert that every entry in sublist is present in superlist."""
304
306
        missing = []
305
307
        for entry in sublist:
616
618
        """
617
619
        # XXX: It's OK to just create them using forward slashes on windows?
618
620
        if transport is None or transport.is_readonly():
619
 
            transport = bzrlib.transport.get_transport(".")
 
621
            transport = get_transport(".")
620
622
        for name in shape:
621
623
            self.assert_(isinstance(name, basestring))
622
624
            if name[-1] == '/':
729
731
            base = base + relpath
730
732
        return base
731
733
 
 
734
    def get_transport(self):
 
735
        """Return a writeable transport for the test scratch space"""
 
736
        t = get_transport(self.get_url())
 
737
        self.assertFalse(t.is_readonly())
 
738
        return t
 
739
 
 
740
    def get_readonly_transport(self):
 
741
        """Return a readonly transport for the test scratch space
 
742
        
 
743
        This can be used to test that operations which should only need
 
744
        readonly access in fact do not try to write.
 
745
        """
 
746
        t = get_transport(self.get_readonly_url())
 
747
        self.assertTrue(t.is_readonly())
 
748
        return t
 
749
 
732
750
    def make_branch(self, relpath):
733
751
        """Create a branch on the transport at relpath."""
734
752
        repo = self.make_repository(relpath)
737
755
    def make_bzrdir(self, relpath):
738
756
        try:
739
757
            url = self.get_url(relpath)
740
 
            segments = url.split('/')
 
758
            segments = relpath.split('/')
741
759
            if segments and segments[-1] not in ('', '.'):
742
 
                parent = '/'.join(segments[:-1])
743
 
                t = bzrlib.transport.get_transport(parent)
 
760
                parent = self.get_url('/'.join(segments[:-1]))
 
761
                t = get_transport(parent)
744
762
                try:
745
763
                    t.mkdir(segments[-1])
746
764
                except errors.FileExists:
876
894
                   'bzrlib.tests.test_http',
877
895
                   'bzrlib.tests.test_identitymap',
878
896
                   'bzrlib.tests.test_inv',
 
897
                   'bzrlib.tests.test_lockdir',
879
898
                   'bzrlib.tests.test_lockable_files',
880
899
                   'bzrlib.tests.test_log',
881
900
                   'bzrlib.tests.test_merge',