Browse Source

And tests too

pull/242/head
Florian Mounier 10 years ago
parent
commit
831b065c89
  1. 6
      pygal/__init__.py
  2. 9
      pygal/test/test_maps.py

6
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

9
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
Loading…
Cancel
Save