~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: James Henstridge
  • Date: 2006-06-12 15:17:23 UTC
  • mto: (1711.2.53 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1786.
  • Revision ID: james.henstridge@canonical.com-20060612151723-9957f7e258567856
changes suggested by John Meinel

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
import os
18
18
from cStringIO import StringIO
 
19
import errno
19
20
from tempfile import TemporaryFile
20
21
 
21
22
from bzrlib.diff import internal_diff, external_diff, show_diff_trees
22
23
from bzrlib.errors import BinaryFile
23
24
import bzrlib.patiencediff
24
 
from bzrlib.tests import TestCase, TestCaseWithTransport, TestCaseInTempDir
 
25
from bzrlib.tests import (
 
26
    TestCase, TestCaseWithTransport, TestCaseInTempDir, TestSkipped)
25
27
 
26
28
 
27
29
def udiff_lines(old, new, allow_binary=False):
32
34
 
33
35
def external_udiff_lines(old, new):
34
36
    output = TemporaryFile()
35
 
    external_diff('old', old, 'new', new, output, diff_opts=['-u'])
 
37
    try:
 
38
        external_diff('old', old, 'new', new, output, diff_opts=['-u'])
 
39
    except OSError, e:
 
40
        # if the diff program could not be found, skip the test
 
41
        if e.errno == errno.ENOENT:
 
42
            raise TestSkipped
36
43
    output.seek(0, 0)
37
44
    lines = output.readlines()
38
45
    output.close()
39
46
    return lines
40
47
 
41
48
 
42
 
 
43
49
class TestDiff(TestCase):
44
50
 
45
51
    def test_add_nl(self):