From b0ea57492b5ec84ad2bfda72af076c2061cce85b Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 17 Dec 2015 16:51:15 +0100 Subject: [PATCH] Correct test_song --- patacrep/build.py | 5 +++-- test/test_song/test_parser.py | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/patacrep/build.py b/patacrep/build.py index 114f121a..00bc8e07 100644 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -81,8 +81,9 @@ class Songbook(object): config['book']['lang'], config['book']['encoding'], ) - config.update(renderer.get_variables()) - config.update(self.config) + # todo: better management of template variables + #config.update(renderer.get_variables()) + #config.update(self.config) config['_compiled_authwords'] = authors.compile_authwords( copy.deepcopy(config['authors']) diff --git a/test/test_song/test_parser.py b/test/test_song/test_parser.py index 0ea602a2..91b33804 100644 --- a/test/test_song/test_parser.py +++ b/test/test_song/test_parser.py @@ -8,7 +8,9 @@ import os import unittest from pkg_resources import resource_filename -from patacrep import files +import yaml + +from patacrep import files, pkg_datapath from patacrep.songs import DEFAULT_CONFIG from patacrep.encoding import open_read @@ -74,13 +76,17 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): def _iter_testmethods(cls): """Iterate over song files to test.""" # Setting datadir - cls.config = DEFAULT_CONFIG - if 'datadir' not in cls.config: - cls.config['datadir'] = [] - cls.config['datadir'].append('datadir') + # Load the default songbook config + default_songbook_path = pkg_datapath('templates', 'default_songbook.sb.yml') + with open_read(default_songbook_path) as default_songbook_file: + cls.config = yaml.load(default_songbook_file) + + if '_datadir' not in cls.config: + cls.config['_datadir'] = [] + cls.config['_datadir'].append('datadir') cls.song_plugins = files.load_plugins( - datadirs=cls.config['datadir'], + datadirs=cls.config['_datadir'], root_modules=['songs'], keyword='SONG_RENDERERS', )