~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Jonathan Lange
  • Date: 2007-07-18 01:56:56 UTC
  • mto: (2653.1.1 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 2654.
  • Revision ID: jml@mumak.net-20070718015656-nksl6vzrgwsglg32
Skip the unicode filename test if the platform doesn't support unicode 
filenames.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
from bzrlib.errors import BinaryFile, NoDiff
25
25
import bzrlib.osutils as osutils
26
26
import bzrlib.patiencediff
27
 
from bzrlib.tests import (TestCase, TestCaseWithTransport,
 
27
from bzrlib.tests import (Feature, TestCase, TestCaseWithTransport,
28
28
                          TestCaseInTempDir, TestSkipped)
29
29
 
30
30
 
 
31
class _UnicodeFilename(Feature):
 
32
    """Does the filesystem support Unicode filenames?"""
 
33
 
 
34
    def _probe(self):
 
35
        filename = u'\u03b1'
 
36
        os.mkdir('tree')
 
37
        try:
 
38
            fd = file('tree/' + filename, 'wb')
 
39
        except UnicodeEncodeError:
 
40
            return False
 
41
        fd.close()
 
42
        os.remove('tree/' + filename)
 
43
        os.rmdir('tree')
 
44
        return True
 
45
 
 
46
UnicodeFilename = _UnicodeFilename()
 
47
 
 
48
 
31
49
def udiff_lines(old, new, allow_binary=False):
32
50
    output = StringIO()
33
51
    internal_diff('old', old, 'new', new, output, allow_binary)
446
464
        is a binary file in the diff.
447
465
        """
448
466
        # See https://bugs.launchpad.net/bugs/110092.
 
467
        self.requireFeature(UnicodeFilename)
449
468
 
450
469
        # This bug isn't triggered with cStringIO.
451
470
        from StringIO import StringIO