~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: Vincent Ladeuil
  • Date: 2011-07-06 09:22:00 UTC
  • mfrom: (6008 +trunk)
  • mto: (6012.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 6013.
  • Revision ID: v.ladeuil+lp@free.fr-20110706092200-7iai2mwzc0sqdsvf
MergingĀ inĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
import stat
21
21
import sys
22
22
 
23
 
from bzrlib import tests
 
23
from bzrlib import (
 
24
    osutils,
 
25
    tests,
 
26
    )
24
27
 
25
28
 
26
29
class _NotRunningAsRoot(tests.Feature):
40
43
not_running_as_root = _NotRunningAsRoot()
41
44
 
42
45
apport = tests.ModuleAvailableFeature('apport')
 
46
gpgme = tests.ModuleAvailableFeature('gpgme')
 
47
lzma = tests.ModuleAvailableFeature('lzma')
43
48
meliae = tests.ModuleAvailableFeature('meliae')
44
49
paramiko = tests.ModuleAvailableFeature('paramiko')
45
50
pycurl = tests.ModuleAvailableFeature('pycurl')
46
51
pywintypes = tests.ModuleAvailableFeature('pywintypes')
47
52
sphinx = tests.ModuleAvailableFeature('sphinx')
48
53
subunit = tests.ModuleAvailableFeature('subunit')
 
54
testtools = tests.ModuleAvailableFeature('testtools')
49
55
 
50
56
 
51
57
class _BackslashDirSeparatorFeature(tests.Feature):
114
120
        return self._path
115
121
 
116
122
    def _probe(self):
117
 
        path = os.environ.get('PATH')
118
 
        if path is None:
119
 
            return False
120
 
        for d in path.split(os.pathsep):
121
 
            if d:
122
 
                f = os.path.join(d, self.name)
123
 
                if os.access(f, os.X_OK):
124
 
                    self._path = f
125
 
                    return True
126
 
        return False
 
123
        self._path = osutils.find_executable_on_path(self.name)
 
124
        return self._path is not None
127
125
 
128
126
    def feature_name(self):
129
127
        return '%s executable' % self.name