~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_diff.py

  • Committer: Martin von Gagern
  • Date: 2011-09-19 08:49:15 UTC
  • mto: This revision was merged to the branch mainline in revision 6148.
  • Revision ID: martin.vgagern@gmx.net-20110919084915-vbumflqq3xqm1vez
Avoid using deprecated api in the unit tests for bzrlib.missing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
29
29
    DiffTree,
30
30
    format_registry as diff_format_registry,
31
31
    )
 
32
from bzrlib.tests import (
 
33
    features,
 
34
    )
32
35
 
33
36
 
34
37
def subst_dates(string):
320
323
        self.build_tree_contents([('hello', 'hello world!\n')])
321
324
        output = self.run_bzr('diff --format=boo', retcode=1)
322
325
        self.assertTrue("BOO!" in output[0])
 
326
        output = self.run_bzr('diff -Fboo', retcode=1)
 
327
        self.assertTrue("BOO!" in output[0])
323
328
 
324
329
 
325
330
class TestCheckoutDiff(TestDiff):
384
389
        # subprocess.py that we had to workaround).
385
390
        # However, if 'diff' may not be available
386
391
        self.make_example_branch()
387
 
        # this will be automatically restored by the base bzr test class
388
 
        os.environ['BZR_PROGRESS_BAR'] = 'none'
 
392
        self.overrideEnv('BZR_PROGRESS_BAR', 'none')
389
393
        out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
390
394
                                           universal_newlines=True,
391
395
                                           retcode=None)
400
404
        self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n"
401
405
                                 "+baz\n\n")
402
406
 
 
407
    def test_external_diff_options_and_using(self):
 
408
        """Test that the options are passed correctly to an external diff process"""
 
409
        self.requireFeature(features.diff_feature)
 
410
        self.make_example_branch()
 
411
        self.build_tree_contents([('hello', 'Foo\n')])
 
412
        out, err = self.run_bzr('diff --diff-options -i --using diff',
 
413
                                    retcode=1)
 
414
        self.assertEquals("=== modified file 'hello'\n", out)
 
415
        self.assertEquals('', err)
 
416
 
403
417
 
404
418
class TestDiffOutput(DiffBase):
405
419