def test_load_themes_from(self): test_path = join(self.TESTS, 'themes') themes_iter = load_themes_from(test_path) themes = list(sorted(themes_iter, key=attrgetter('identifier'))) self.assertEqual(themes[0].identifier, 'cool') self.assertEqual(themes[1].identifier, 'notthis') self.assertEqual(themes[2].identifier, 'plain')
def instance_theme_loader(app): themes_dir = os.path.join(app.instance_path, 'themes') if os.path.isdir(themes_dir): return load_themes_from(themes_dir) else: return ()