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. 16
      test/test_compilation/test_compilation.py

10
.travis.yml

@ -7,3 +7,13 @@ install:
- pip install tox - pip install tox
script: script:
- tox - 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" : [ "bookoptions" : [
"lilypond",
"pictures" "pictures"
], ],
"datadir": ["subdir_datadir", "subdir_datadir2"], "datadir": ["subdir_datadir", "subdir_datadir2"],

1
test/test_compilation/subdir.tex.control

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

16
test/test_compilation/test_compilation.py

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

Loading…
Cancel
Save