def inner(*args, **kwargs): """Save and restore state.""" saved_env = {} restore_piglitconf = False try: for env in ['XDG_CONFIG_HOME', 'HOME']: if env in os.environ: saved_env[env] = os.environ.pop(env) if os.path.exists('piglit.conf'): shutil.move('piglit.conf', 'piglit.conf.restore') restore_piglitconf = True core.PIGLIT_CONFIG = core.PiglitConfig(allow_no_value=True) except Exception as e: raise utils.UtilsError(e) func(*args, **kwargs) try: for env in ['XDG_CONFIG_HOME', 'HOME']: if env in saved_env: os.environ[env] = saved_env[env] elif env in os.environ: del os.environ[env] if restore_piglitconf: shutil.move('piglit.conf.restore', 'piglit.conf') core.PIGLIT_CONFIG = core.PiglitConfig(allow_no_value=True) except Exception as e: raise utils.UtilsError(e)
def setup_class(cls): cls.conf = core.PiglitConfig() cls.conf.add_section('set') cls.conf.set('set', 'options', 'bool')
def setup_module(): core.PIGLIT_CONFIG = core.PiglitConfig(allow_no_value=True) core.get_config()
def test_PiglitConfig_init(): """core.PiglitConfig: initializes""" core.PiglitConfig()