~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

Merge pt1 hooks branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import os
20
20
import stat
21
21
 
22
 
from bzrlib import tests
 
22
from bzrlib import (
 
23
    osutils,
 
24
    tests,
 
25
    )
23
26
 
24
27
 
25
28
class _NotRunningAsRoot(tests.Feature):
113
116
        return self._path
114
117
 
115
118
    def _probe(self):
116
 
        path = os.environ.get('PATH')
117
 
        if path is None:
118
 
            return False
119
 
        for d in path.split(os.pathsep):
120
 
            if d:
121
 
                f = os.path.join(d, self.name)
122
 
                if os.access(f, os.X_OK):
123
 
                    self._path = f
124
 
                    return True
125
 
        return False
 
119
        self._path = osutils.find_executable_on_path(self.name)
 
120
        return self._path is not None
126
121
 
127
122
    def feature_name(self):
128
123
        return '%s executable' % self.name