~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 15:55:48 UTC
  • mto: (4985.1.4 add-attr-cleanup)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125155548-0l352pujvt5bzl5e
Deploy addAttrCleanup on the whole test suite.

Several use case worth mentioning:

- setting a module or any other object attribute is the majority
by far. In some cases the setting itself is deferred but most of
the time we want to set at the same time we add the cleanup.

- there multiple occurrences of protecting hooks or ui factory
which are now useless (the test framework takes care of that now),

- there was some lambda uses that can now be avoided.

That first cleanup already simplifies things a lot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
import os
22
22
import re
23
23
 
24
 
import bzrlib
25
 
from bzrlib import workingtree
26
 
from bzrlib.branch import Branch
27
 
from bzrlib.tests import TestSkipped
28
 
from bzrlib.tests.blackbox import ExternalBase
 
24
from bzrlib import (
 
25
    tests,
 
26
    workingtree,
 
27
    )
29
28
 
30
29
 
31
30
def subst_dates(string):
34
33
                  'YYYY-MM-DD HH:MM:SS +ZZZZ', string)
35
34
 
36
35
 
37
 
class DiffBase(ExternalBase):
 
36
class DiffBase(tests.TestCaseWithTransport):
38
37
    """Base class with common setup method"""
39
38
 
40
39
    def make_example_branch(self):
355
354
 
356
355
    def test_external_diff(self):
357
356
        """Test that we can spawn an external diff process"""
 
357
        self.disable_missing_extensions_warning()
358
358
        # We have to use run_bzr_subprocess, because we need to
359
359
        # test writing directly to stdout, (there was a bug in
360
360
        # subprocess.py that we had to workaround).
366
366
                                           universal_newlines=True,
367
367
                                           retcode=None)
368
368
        if 'Diff is not installed on this machine' in err:
369
 
            raise TestSkipped("No external 'diff' is available")
 
369
            raise tests.TestSkipped("No external 'diff' is available")
370
370
        self.assertEqual('', err)
371
371
        # We have to skip the stuff in the middle, because it depends
372
372
        # on time.time()