~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/features.py

  • Committer: Zearin
  • Date: 2010-11-12 22:36:19 UTC
  • mto: (5570.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5572.
  • Revision ID: zearin@users.sourceforge.net-20101112223619-1i2oscfgg1xgzuqk
Continued capitalization fixes ([S]FTP, SSH).

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
18
18
 
19
19
import os
20
20
import stat
21
 
import sys
22
21
 
23
 
from bzrlib import (
24
 
    osutils,
25
 
    tests,
26
 
    )
 
22
from bzrlib import tests
 
23
from bzrlib.symbol_versioning import deprecated_in
27
24
 
28
25
 
29
26
class _NotRunningAsRoot(tests.Feature):
43
40
not_running_as_root = _NotRunningAsRoot()
44
41
 
45
42
apport = tests.ModuleAvailableFeature('apport')
46
 
gpgme = tests.ModuleAvailableFeature('gpgme')
47
 
lzma = tests.ModuleAvailableFeature('lzma')
48
43
meliae = tests.ModuleAvailableFeature('meliae')
49
44
paramiko = tests.ModuleAvailableFeature('paramiko')
50
45
pycurl = tests.ModuleAvailableFeature('pycurl')
51
46
pywintypes = tests.ModuleAvailableFeature('pywintypes')
52
47
sphinx = tests.ModuleAvailableFeature('sphinx')
53
48
subunit = tests.ModuleAvailableFeature('subunit')
54
 
testtools = tests.ModuleAvailableFeature('testtools')
55
49
 
56
50
 
57
51
class _BackslashDirSeparatorFeature(tests.Feature):
120
114
        return self._path
121
115
 
122
116
    def _probe(self):
123
 
        self._path = osutils.find_executable_on_path(self.name)
124
 
        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
125
127
 
126
128
    def feature_name(self):
127
129
        return '%s executable' % self.name
130
132
bash_feature = ExecutableFeature('bash')
131
133
sed_feature = ExecutableFeature('sed')
132
134
diff_feature = ExecutableFeature('diff')
133
 
 
134
 
 
135
 
class Win32Feature(tests.Feature):
136
 
    """Feature testing whether we're running selftest on Windows
137
 
    or Windows-like platform.
138
 
    """
139
 
 
140
 
    def _probe(self):
141
 
        return sys.platform == 'win32'
142
 
 
143
 
    def feature_name(self):
144
 
        return "win32 platform"
145
 
 
146
 
win32_feature = Win32Feature()