~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: Vincent Ladeuil
  • Date: 2011-05-17 20:58:43 UTC
  • mfrom: (5609.39.5 2.3)
  • mto: This revision was merged to the branch mainline in revision 5885.
  • Revision ID: v.ladeuil+lp@free.fr-20110517205843-uo1tntrz6kqfn1hb
Merge 2.3 into trunk

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):
38
40
 
39
41
 
40
42
not_running_as_root = _NotRunningAsRoot()
 
43
 
41
44
apport = tests.ModuleAvailableFeature('apport')
 
45
lzma = tests.ModuleAvailableFeature('lzma')
 
46
meliae = tests.ModuleAvailableFeature('meliae')
42
47
paramiko = tests.ModuleAvailableFeature('paramiko')
43
48
pycurl = tests.ModuleAvailableFeature('pycurl')
44
49
pywintypes = tests.ModuleAvailableFeature('pywintypes')
 
50
sphinx = tests.ModuleAvailableFeature('sphinx')
45
51
subunit = tests.ModuleAvailableFeature('subunit')
46
 
sphinx = tests.ModuleAvailableFeature('sphinx')
47
52
 
48
53
 
49
54
class _BackslashDirSeparatorFeature(tests.Feature):
112
117
        return self._path
113
118
 
114
119
    def _probe(self):
115
 
        path = os.environ.get('PATH')
116
 
        if path is None:
117
 
            return False
118
 
        for d in path.split(os.pathsep):
119
 
            if d:
120
 
                f = os.path.join(d, self.name)
121
 
                if os.access(f, os.X_OK):
122
 
                    self._path = f
123
 
                    return True
124
 
        return False
 
120
        self._path = osutils.find_executable_on_path(self.name)
 
121
        return self._path is not None
125
122
 
126
123
    def feature_name(self):
127
124
        return '%s executable' % self.name