~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_transport.py

  • Committer: Zearin
  • Date: 2010-11-12 22:08:18 UTC
  • mto: (5570.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5572.
  • Revision ID: zearin@users.sourceforge.net-20101112220818-mb62len4zyxr8qvd
Fixed capitalization of XML and HTTP.  Fixed by hand and only where appropriate (e.g., left http://some/url lowercase, but capitalized "When making an HTTP request…").

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
from StringIO import StringIO as pyStringIO
27
27
import stat
28
28
import sys
29
 
import unittest
30
29
 
31
30
from bzrlib import (
32
31
    errors,
33
32
    osutils,
 
33
    pyutils,
34
34
    tests,
35
35
    urlutils,
36
36
    )
37
37
from bzrlib.errors import (ConnectionError,
38
 
                           DirectoryNotEmpty,
39
38
                           FileExists,
40
39
                           InvalidURL,
41
 
                           LockError,
42
40
                           NoSuchFile,
43
 
                           NotLocalUrl,
44
41
                           PathError,
45
42
                           TransportNotPossible,
46
43
                           )
47
44
from bzrlib.osutils import getcwd
48
45
from bzrlib.smart import medium
49
46
from bzrlib.tests import (
50
 
    TestCaseInTempDir,
51
47
    TestSkipped,
52
48
    TestNotApplicable,
53
49
    multiply_tests,
78
74
    for module in _get_transport_modules():
79
75
        try:
80
76
            permutations = get_transport_test_permutations(
81
 
                reduce(getattr, (module).split('.')[1:], __import__(module)))
 
77
                pyutils.get_named_object(module))
82
78
            for (klass, server_factory) in permutations:
83
79
                scenario = ('%s,%s' % (klass.__name__, server_factory.__name__),
84
80
                    {"transport_class":klass,
251
247
 
252
248
    def test_get_bytes_unknown_file(self):
253
249
        t = self.get_transport()
254
 
 
255
250
        self.assertRaises(NoSuchFile, t.get_bytes, 'c')
256
251
 
257
252
    def test_get_with_open_write_stream_sees_all_content(self):
1122
1117
            self.failUnless(t.has(link_name))
1123
1118
 
1124
1119
            st = t.stat(link_name)
1125
 
            self.failUnless(S_ISLNK(st.st_mode))
 
1120
            self.failUnless(S_ISLNK(st.st_mode),
 
1121
                "expected symlink, got mode %o" % st.st_mode)
1126
1122
        except TransportNotPossible:
1127
1123
            raise TestSkipped("Transport %s does not support symlinks." %
1128
1124
                              self._server.__class__)
1265
1261
        self.assertIs(t._get_connection(), c._get_connection())
1266
1262
 
1267
1263
        # Temporary failure, we need to create a new dummy connection
1268
 
        new_connection = object()
 
1264
        new_connection = None
1269
1265
        t._set_connection(new_connection)
1270
1266
        # Check that both transports use the same connection
1271
1267
        self.assertIs(new_connection, t._get_connection())
1765
1761
        # also raise a special error
1766
1762
        self.assertListRaises((errors.ShortReadvError, errors.InvalidRange),
1767
1763
                              transport.readv, 'a', [(12,2)])
 
1764
 
 
1765
    def test_stat_symlink(self):
 
1766
        # if a transport points directly to a symlink (and supports symlinks
 
1767
        # at all) you can tell this.  helps with bug 32669.
 
1768
        t = self.get_transport()
 
1769
        try:
 
1770
            t.symlink('target', 'link')
 
1771
        except TransportNotPossible:
 
1772
            raise TestSkipped("symlinks not supported")
 
1773
        t2 = t.clone('link')
 
1774
        st = t2.stat('')
 
1775
        self.assertTrue(stat.S_ISLNK(st.st_mode))