~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Aaron Bentley
  • Date: 2008-06-06 16:40:46 UTC
  • mfrom: (3482 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3483.
  • Revision ID: aaron@aaronbentley.com-20080606164046-ghbxplxuhtpcb9iz
Merge with bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
CompiledPatienceDiffFeature = _CompiledPatienceDiffFeature()
57
57
 
58
58
 
59
 
class _UnicodeFilename(Feature):
60
 
    """Does the filesystem support Unicode filenames?"""
61
 
 
62
 
    def _probe(self):
63
 
        try:
64
 
            os.stat(u'\u03b1')
65
 
        except UnicodeEncodeError:
66
 
            return False
67
 
        except (IOError, OSError):
68
 
            # The filesystem allows the Unicode filename but the file doesn't
69
 
            # exist.
70
 
            return True
71
 
        else:
72
 
            # The filesystem allows the Unicode filename and the file exists,
73
 
            # for some reason.
74
 
            return True
75
 
 
76
 
UnicodeFilename = _UnicodeFilename()
77
 
 
78
 
 
79
 
class TestUnicodeFilename(TestCase):
80
 
 
81
 
    def test_probe_passes(self):
82
 
        """UnicodeFilename._probe passes."""
83
 
        # We can't test much more than that because the behaviour depends
84
 
        # on the platform.
85
 
        UnicodeFilename._probe()
86
 
        
87
 
 
88
59
def udiff_lines(old, new, allow_binary=False):
89
60
    output = StringIO()
90
61
    internal_diff('old', old, 'new', new, output, allow_binary)
548
519
        is a binary file in the diff.
549
520
        """
550
521
        # See https://bugs.launchpad.net/bugs/110092.
551
 
        self.requireFeature(UnicodeFilename)
 
522
        self.requireFeature(tests.UnicodeFilenameFeature)
552
523
 
553
524
        # This bug isn't triggered with cStringIO.
554
525
        from StringIO import StringIO
573
544
 
574
545
    def test_unicode_filename(self):
575
546
        """Test when the filename are unicode."""
576
 
        self.requireFeature(UnicodeFilename)
 
547
        self.requireFeature(tests.UnicodeFilenameFeature)
577
548
 
578
549
        alpha, omega = u'\u03b1', u'\u03c9'
579
550
        autf8, outf8 = alpha.encode('utf8'), omega.encode('utf8')