Browse Source

Log the output in case of command failure

pull/132/head
Oliverpool 9 years ago
parent
commit
255788a2d2
  1. 20
      test/test_compilation/test_compilation.py

20
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.
@ -96,24 +98,14 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
if steps: if steps:
command.extend(['--steps', steps]) command.extend(['--steps', steps])
return subprocess.check_call(
command,
stdin=subprocess.DEVNULL,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
cwd=os.path.dirname(songbook),
)
#temp fix for travis tests
try: try:
val = subprocess.check_output( subprocess.check_output(
command, command,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
universal_newlines=True, universal_newlines=True,
cwd=os.path.dirname(songbook), cwd=os.path.dirname(songbook),
) )
print("###ok") return 0
print(val)
print("ok###")
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:
print(e.output) LOGGER.warning(e.output)
return 1 return e.returncode
Loading…
Cancel
Save