我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用oslotest.base.BaseTestCase()。
def setUp(self): super(BaseTestCase, self).setUp() self.addCleanup(CONF.reset)
def setUp(self): super(BaseTestCase, self).setUp() self.addCleanup(cfg.CONF.reset) mod_dir = os.path.dirname(sys.modules[__name__].__file__) self.project_dir = os.path.abspath(os.path.join(mod_dir, '..', '..'))
def setUp(self): super(BaseTestCase, self).setUp() self.useFixture(fixtures.NestedTempfile()) self.useFixture(fixtures.TempHomeDir()) self.useFixture(log_fixture.get_logging_handle_error_fixture()) self.useFixture(ConfigFixture(CONF)) self.useFixture(oc_fixture.ClearRequestContext()) self.useFixture(PolicyFixture())
def _prepare_policy(self): policy_dir = self.useFixture(fixtures.TempDir()) policy_file = os.path.join(policy_dir.path, 'policy.yaml') # load the fake_policy data and add the missing default rules. policy_rules = jsonutils.loads('{}') self.add_missing_default_rules(policy_rules) with open(policy_file, 'w') as f: jsonutils.dump(policy_rules, f) BaseTestCase.conf_override(policy_file=policy_file, group='oslo_policy') BaseTestCase.conf_override(policy_dirs=[], group='oslo_policy')