def make_context(self, *args, **kwargs): """ Create a context with the given arguments. """ # Determine the context class to use ctxcls = context.RequestContext if 'context_class' in self.options: ctxcls = utils.import_class(self.options['context_class']) return ctxcls(*args, **kwargs)
def test_import_class(self): dt = utils.import_class('datetime.datetime') self.assertEqual(sys.modules['datetime'].datetime, dt)