~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: John Arbash Meinel
  • Date: 2010-11-05 20:54:32 UTC
  • mfrom: (5526 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5527.
  • Revision ID: john@arbash-meinel.com-20101105205432-rmyozu8sthyhmri8
Merge bzr.dev to resolve bzr-2.3.txt (aka NEWS)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2009, 2010, 2011 Canonical Ltd
 
1
# Copyright (C) 2009, 2010 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
19
19
import os
20
20
import stat
21
21
 
22
 
from bzrlib import (
23
 
    osutils,
24
 
    tests,
25
 
    )
 
22
from bzrlib import tests
 
23
from bzrlib.symbol_versioning import deprecated_in
26
24
 
27
25
 
28
26
class _NotRunningAsRoot(tests.Feature):
42
40
not_running_as_root = _NotRunningAsRoot()
43
41
 
44
42
apport = tests.ModuleAvailableFeature('apport')
45
 
lzma = tests.ModuleAvailableFeature('lzma')
46
43
meliae = tests.ModuleAvailableFeature('meliae')
47
44
paramiko = tests.ModuleAvailableFeature('paramiko')
48
45
pycurl = tests.ModuleAvailableFeature('pycurl')
117
114
        return self._path
118
115
 
119
116
    def _probe(self):
120
 
        self._path = osutils.find_executable_on_path(self.name)
121
 
        return self._path is not None
 
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
122
127
 
123
128
    def feature_name(self):
124
129
        return '%s executable' % self.name