~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: John Arbash Meinel
  • Date: 2008-03-17 20:11:30 UTC
  • mto: This revision was merged to the branch mainline in revision 3532.
  • Revision ID: john@arbash-meinel.com-20080317201130-254scn9jqanfvc92
Raise a clear error about the offending filename when there is a filename with bad characters.
Related to bug #77657

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
CompiledPatienceDiffFeature = _CompiledPatienceDiffFeature()
56
56
 
57
57
 
58
 
class _UnicodeFilename(Feature):
59
 
    """Does the filesystem support Unicode filenames?"""
60
 
 
61
 
    def _probe(self):
62
 
        try:
63
 
            os.stat(u'\u03b1')
64
 
        except UnicodeEncodeError:
65
 
            return False
66
 
        except (IOError, OSError):
67
 
            # The filesystem allows the Unicode filename but the file doesn't
68
 
            # exist.
69
 
            return True
70
 
        else:
71
 
            # The filesystem allows the Unicode filename and the file exists,
72
 
            # for some reason.
73
 
            return True
74
 
 
75
 
UnicodeFilename = _UnicodeFilename()
76
 
 
77
 
 
78
 
class TestUnicodeFilename(TestCase):
79
 
 
80
 
    def test_probe_passes(self):
81
 
        """UnicodeFilename._probe passes."""
82
 
        # We can't test much more than that because the behaviour depends
83
 
        # on the platform.
84
 
        UnicodeFilename._probe()
85
 
        
86
 
 
87
58
def udiff_lines(old, new, allow_binary=False):
88
59
    output = StringIO()
89
60
    internal_diff('old', old, 'new', new, output, allow_binary)