<s> import os <EOL> from oslo_config import cfg <EOL> from neutron . agent . common import config <EOL> from neutron . agent . linux import utils <EOL> from neutron . tests import base <EOL> from neutron . tests . common import base as common_base <EOL> SUDO_CMD = '<STR_LIT>' <EOL> DEFAULT_LOG_DIR = '<STR_LIT>' <EOL> class BaseSudoTestCase ( base . BaseTestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> super ( BaseSudoTestCase , self ) . setUp ( ) <EOL> if not base . bool_from_env ( '<STR_LIT>' ) : <EOL> self . skipTest ( '<STR_LIT>' ) <EOL> base . setup_test_logging ( <EOL> cfg . CONF , DEFAULT_LOG_DIR , "<STR_LIT>" % self . id ( ) ) <EOL> config . register_root_helper ( cfg . CONF ) <EOL> self . config ( group = '<STR_LIT>' , <EOL> root_helper = os . environ . get ( '<STR_LIT>' , SUDO_CMD ) ) <EOL> self . config ( group = '<STR_LIT>' , <EOL> root_helper_daemon = os . environ . get ( <EOL> '<STR_LIT>' ) ) <EOL> @ common_base . no_skip_on_missing_deps <EOL> def check_command ( self , cmd , error_text , skip_msg , run_as_root = False ) : <EOL> try : <EOL> utils . execute ( cmd , run_as_root = run_as_root ) <EOL> except RuntimeError as e : <EOL> if error_text in str ( e ) : <EOL> self . skipTest ( skip_msg ) <EOL> raise </s>
