def setUp(self): self.config = {} self.config_dir = tempfile.TemporaryDirectory() os.environ['CONFIG_DIR'] = self.config_dir.name self.write_config() Config._full_reload()
def write_config(self): with open(os.path.join(self.config_dir.name, 'application.yaml'), 'w') as handler: handler.write(yaml.dump(self.config, default_flow_style = False)) Config._full_reload()
def test_no_file(self): os.environ['CONFIG_DIR'] = os.path.join(self.config_dir.name, 'not_a_dir') expect( lambda: Config._full_reload() ).not_to(raise_error)