~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Matt McClure
  • Date: 2008-04-18 23:58:05 UTC
  • mto: (3452.1.1 bzr.dev.mlm)
  • mto: This revision was merged to the branch mainline in revision 3493.
  • Revision ID: mlm@aya.yale.edu-20080418235805-6b9w9w31pevnls6b
Introduces a Feature subclass to encapsulate the availability of 'attrib'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
                          TestCaseInTempDir, TestSkipped)
42
42
 
43
43
 
 
44
class _AttribFeature(Feature):
 
45
 
 
46
    def _probe(self):
 
47
        if (sys.platform not in ('cygwin', 'win32')):
 
48
            return false
 
49
        try:
 
50
            proc = subprocess.Popen(['attrib', '.'], stdout=subprocess.PIPE)
 
51
        except OSError, e:
 
52
            return false
 
53
        return (0 == proc.wait())
 
54
                
 
55
    def feature_name(self):
 
56
        return 'attrib Windows command-line tool'
 
57
 
 
58
AttribFeature = _AttribFeature()
 
59
 
 
60
 
44
61
class _CompiledPatienceDiffFeature(Feature):
45
62
 
46
63
    def _probe(self):
1275
1292
                         ' on this machine', str(e))
1276
1293
 
1277
1294
    def test_windows_tool_reads_both_files(self):
1278
 
        if (sys.platform not in ('cygwin', 'win32')):
1279
 
            raise tests.TestSkipped('Platform does not have Windows tools.')
 
1295
        self.requireFeature(AttribFeature)
1280
1296
        output = StringIO()
1281
1297
        tree = self.make_branch_and_tree('tree')
1282
1298
        self.build_tree_contents([('tree/file', 'content')])