Browse Source

Restore test_content tests

pull/184/head
Oliverpool 9 years ago
parent
commit
0204919280
  1. 2
      patacrep/content/include.py
  2. 12
      test/test_content/test_content.py

2
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

12
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')

Loading…
Cancel
Save