diff --git a/pygal/__init__.py b/pygal/__init__.py index 6e3188c..86f0977 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -60,13 +60,13 @@ CHARTS_BY_NAME = dict( from pygal.graph.map import BaseMap for entry in pkg_resources.iter_entry_points('pygal.maps'): try: - cls = entry.load() + module = entry.load() except Exception: warnings.warn('Unable to load %s pygal plugin \n\n%s' % ( entry, traceback.format_exc()), Warning) continue - setattr(maps, entry.name, cls) - for k, v in cls.__dict__.items(): + setattr(maps, entry.name, module) + for k, v in module.__dict__.items(): if isinstance(v, type) and issubclass(v, BaseMap) and v != BaseMap: CHARTS_BY_NAME[entry.name.capitalize() + k + 'Map'] = v diff --git a/pygal/test/test_maps.py b/pygal/test/test_maps.py new file mode 100644 index 0000000..d211630 --- /dev/null +++ b/pygal/test/test_maps.py @@ -0,0 +1,9 @@ +import pkg_resources + + +# Load plugins tests +for entry in pkg_resources.iter_entry_points('pygal.test.test_maps'): + module = entry.load() + for k, v in module.__dict__.items(): + if k.startswith('test_'): + globals()['test_maps_' + entry.name + '_' + k[5:]] = v