|
|
@ -6,11 +6,13 @@ import glob |
|
|
|
import os |
|
|
|
import subprocess |
|
|
|
import unittest |
|
|
|
import logging |
|
|
|
|
|
|
|
from patacrep.encoding import open_read |
|
|
|
|
|
|
|
from .. import dynamic # pylint: disable=unused-import |
|
|
|
|
|
|
|
LOGGER = logging.getLogger(__name__) |
|
|
|
|
|
|
|
class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): |
|
|
|
"""Test of songbook compilation. |
|
|
@ -92,14 +94,18 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): |
|
|
|
@staticmethod |
|
|
|
def compile_songbook(songbook, steps=None): |
|
|
|
"""Compile songbook, and return the command return code.""" |
|
|
|
command = ['python', '-m', 'patacrep.songbook', songbook] |
|
|
|
command = ['python', '-m', 'patacrep.songbook', songbook, '-v'] |
|
|
|
if steps: |
|
|
|
command.extend(['--steps', steps]) |
|
|
|
|
|
|
|
return subprocess.check_call( |
|
|
|
try: |
|
|
|
subprocess.check_output( |
|
|
|
command, |
|
|
|
stdin=subprocess.DEVNULL, |
|
|
|
stdout=subprocess.DEVNULL, |
|
|
|
stderr=subprocess.DEVNULL, |
|
|
|
stderr=subprocess.STDOUT, |
|
|
|
universal_newlines=True, |
|
|
|
cwd=os.path.dirname(songbook), |
|
|
|
) |
|
|
|
return 0 |
|
|
|
except subprocess.CalledProcessError as error: |
|
|
|
LOGGER.warning(error.output) |
|
|
|
return error.returncode |
|
|
|