Browse Source

Merge pull request #132 from patacrep/travis_tests

Travis tests
pull/120/head
Louis 9 years ago
parent
commit
399189251a
  1. 10
      .travis.yml
  2. 1
      test/test_compilation/subdir.sb
  3. 1
      test/test_compilation/subdir.tex.control
  4. 22
      test/test_compilation/test_compilation.py

10
.travis.yml

@ -7,3 +7,13 @@ install:
- pip install tox
script:
- tox
sudo: false
addons:
apt:
packages:
- texlive-latex-base
- latex-xcolor
- texlive-latex-extra
- pgf
- lmodern
- lilypond

1
test/test_compilation/subdir.sb

@ -1,6 +1,5 @@
{
"bookoptions" : [
"lilypond",
"pictures"
],
"datadir": ["subdir_datadir", "subdir_datadir2"],

1
test/test_compilation/subdir.tex.control

@ -25,7 +25,6 @@
\usepackage[
chorded,
lilypond,
pictures,
guitar,
]{patacrep}

22
test/test_compilation/test_compilation.py

@ -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(
command,
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
cwd=os.path.dirname(songbook),
)
try:
subprocess.check_output(
command,
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

Loading…
Cancel
Save