~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-04-18 04:55:00 UTC
  • mfrom: (5784.2.1 754188-apport-test)
  • Revision ID: pqm@pqm.ubuntu.com-20110418045500-ce6lkgyiq7f47q43
(mbp) Rewrite test_report_bug_legacy away from using doctest (see bug
 764188) (Martin Pool)

Show diffs side-by-side

added added

removed removed

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