~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: 2010-09-27 20:08:36 UTC
  • mfrom: (5447.1.1 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20100927200836-asjq41qt5fol30df
(vila) Merge lp:bzr/2.2 into trunk including fixes for #644855,
        #646133, #632387 (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from bzrlib.symbol_versioning import deprecated_in
24
24
 
25
25
 
 
26
class _NotRunningAsRoot(tests.Feature):
 
27
 
 
28
    def _probe(self):
 
29
        try:
 
30
            uid = os.getuid()
 
31
        except AttributeError:
 
32
            # If there is no uid, chances are there is no root either
 
33
            return True
 
34
        return uid != 0
 
35
 
 
36
    def feature_name(self):
 
37
        return 'Not running as root'
 
38
 
 
39
 
 
40
not_running_as_root = _NotRunningAsRoot()
26
41
apport = tests.ModuleAvailableFeature('apport')
27
42
paramiko = tests.ModuleAvailableFeature('paramiko')
28
43
pycurl = tests.ModuleAvailableFeature('pycurl')