From 0204919280067da93c7512a4fe6f32410192e3e2 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Fri, 18 Dec 2015 12:27:10 +0100 Subject: [PATCH] Restore test_content tests --- patacrep/content/include.py | 2 +- test/test_content/test_content.py | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/patacrep/content/include.py b/patacrep/content/include.py index bfd5db5c..0dbba32c 100644 --- a/patacrep/content/include.py +++ b/patacrep/content/include.py @@ -46,7 +46,7 @@ def parse(keyword, config, argument, contentlist): try: with encoding.open_read( filepath, - encoding=config['encoding'] + encoding=config['book']['encoding'] ) as content_file: new_content = json.load(content_file) except Exception as error: # pylint: disable=broad-except diff --git a/test/test_content/test_content.py b/test/test_content/test_content.py index 868b8fc5..4d824346 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -2,8 +2,6 @@ # pylint: disable=too-few-public-methods -#pylint: skip-file - import glob import os import unittest @@ -11,9 +9,10 @@ import json import yaml -from patacrep.songs import DataSubpath, DEFAULT_CONFIG +from patacrep.songs import DataSubpath from patacrep import content, encoding, files, pkg_datapath from patacrep.content import song, section, songsection, tex +from patacrep.build import config_model from .. import logging_reduced from .. import dynamic # pylint: disable=unused-import @@ -35,7 +34,6 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): @classmethod def _iter_testmethods(cls): - return """Iterate over dynamically generated test methods""" for source in sorted(glob.glob(os.path.join( os.path.dirname(__file__), @@ -101,14 +99,12 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Generate the config to process the content""" # Load the default songbook config - default_songbook_path = pkg_datapath('templates', 'default_songbook.sb.yml') - with encoding.open_read(default_songbook_path) as default_songbook_file: - config = yaml.load(default_songbook_file) + config = config_model('default') datadirpaths = [os.path.join(os.path.dirname(__file__), 'datadir')] # todo : yaml and testing? - config['datadir'] = datadirpaths + config['_datadir'] = datadirpaths config['_songdir'] = [ DataSubpath(path, 'songs')