コード例 #1
0
 def test_invalid_modulename(self):
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("allmodulenoklass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("badmodule.badclass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.blah")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.BADClass")
コード例 #2
0
 def test_invalid_modulename(self):
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("allmodulenoklass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("badmodule.badclass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.blah")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.BADClass")
コード例 #3
0
def _load_zone(zone_name, **config):
    vary_klass = load_class_from_path(config['VARY'])
    return ThrottleZone(zone_name, vary_klass, **config)
コード例 #4
0
def load_backend_from_path(classpath):
    klass = load_class_from_path(classpath)
    try:
        return klass()
    except TypeError:
        raise ImproperlyConfigured("%s is not callable" % (klass.__name__))
コード例 #5
0
 def test_get_module(self):
     module = load_class_from_path("throttle.tests.backends.TestThrottleBackend")
     self.assertEqual(module.__name__, 'TestThrottleBackend')
コード例 #6
0
 def test_get_module(self):
     module = load_class_from_path(
         "throttle.tests.backends.TestThrottleBackend")
     self.assertEqual(module.__name__, 'TestThrottleBackend')
コード例 #7
0
def _load_zone(zone_name, **config):
    vary_klass = load_class_from_path(config['VARY'])
    return ThrottleZone(zone_name, vary_klass, **config)