@attr('root')
def onlyroot(meth):
 @wraps(meth)
 def test_inner_onlyroot(self, *args, **kwds):
  'Note that this method needs to start with test_ in order for nose\n        to run it!'
  if ((os.geteuid() == 0) or (os.getuid() == 0)):
   return meth(self, *args, **kwds)
  else:
   raise SkipTest('This test requires root privileges.')
 test_inner_onlyroot.root = True
 return test_inner_onlyroot

@ attr ( 'root' ) def onlyroot ( meth ) : @ wraps ( meth ) def test_inner_onlyroot ( self , * args , ** kwds ) : if ( ( os . geteuid ( ) == 0 ) or ( os . getuid ( ) == 0 ) ) : return meth ( self , * args , ** kwds ) else : raise SkipTest ( 'This test requires root privileges.' ) test_inner_onlyroot . root = True return test_inner_onlyroot
function to decorate tests that should be called as root .