From 93805c97f4d4be60357999574f6593f82bc8a9d7 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 18:36:30 +0200 Subject: [PATCH 01/14] Try to use the new Travis infrastructure --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 53282da2..7051b457 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,3 +7,4 @@ install: - pip install tox script: - tox +sudo: false From 3f04f1337e2fc1e086be672911f35745712a3e18 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 18:41:14 +0200 Subject: [PATCH 02/14] [temp] change default debug level --- patacrep/songbook/__main__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index 5713b4a9..e205f5f8 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -14,7 +14,7 @@ from patacrep import errors import patacrep.encoding # Logging configuration -logging.basicConfig(level=logging.INFO) +logging.basicConfig(level=logging.DEBUG) LOGGER = logging.getLogger() # pylint: disable=too-few-public-methods From 320e94cfd86f04426819488299bac88dd9bfda3e Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 18:59:36 +0200 Subject: [PATCH 03/14] Display command output --- test/test_compilation/test_compilation.py | 28 +++++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index 9a2e77de..3aad14eb 100644 --- a/test/test_compilation/test_compilation.py +++ b/test/test_compilation/test_compilation.py @@ -96,10 +96,24 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): 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), - ) + 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: + val = subprocess.check_output( + command, + stderr=subprocess.STDOUT, + universal_newlines=True, + cwd=os.path.dirname(songbook), + ) + print("###ok") + print(val) + print("ok###") + except subprocess.CalledProcessError as e: + print(e.output) + return 1 \ No newline at end of file From f06ca48307fe732d4b63e627277a11537b15bd77 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:01:19 +0200 Subject: [PATCH 04/14] Travis needs latex-base (at least) --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.travis.yml b/.travis.yml index 7051b457..336cf80f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,3 +8,7 @@ install: script: - tox sudo: false +addons: + apt: + packages: + - texlive-latex-base From 12dfa0a748f5615f12254c351ff46074345cbf39 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:06:49 +0200 Subject: [PATCH 05/14] latex-xcolor is required as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 336cf80f..91054fb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,3 +12,4 @@ addons: apt: packages: - texlive-latex-base + - latex-xcolor From 7be96435374f4f0bddb95e4e7792009ec675e7fb Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:08:51 +0200 Subject: [PATCH 06/14] latex-extra is required as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 91054fb2..d5f93169 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,3 +13,4 @@ addons: packages: - texlive-latex-base - latex-xcolor + - texlive-latex-extra From 3fb2d58a53d6b2c97ddc156d233ff534814d35be Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:11:18 +0200 Subject: [PATCH 07/14] pgf is required as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index d5f93169..afd9211b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,3 +14,4 @@ addons: - texlive-latex-base - latex-xcolor - texlive-latex-extra + - pgf From e1ea347459aa0d646433763fb4484528da8abcf1 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:13:22 +0200 Subject: [PATCH 08/14] lmodern is required as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index afd9211b..b01bcf23 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,3 +15,4 @@ addons: - latex-xcolor - texlive-latex-extra - pgf + - lmodern From 406300d1ca72faab453e81ac532b112c8fff4acb Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:15:12 +0200 Subject: [PATCH 09/14] lilypond is required as well --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index b01bcf23..2b4b68ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,3 +16,4 @@ addons: - texlive-latex-extra - pgf - lmodern + - lilypond From e81d88e95321229b5dbca9affbce4a08196a240b Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:28:44 +0200 Subject: [PATCH 10/14] Travis does not allow lilypond (yet) --- test/test_compilation/subdir.sb | 1 - test/test_compilation/subdir.tex.control | 1 - 2 files changed, 2 deletions(-) diff --git a/test/test_compilation/subdir.sb b/test/test_compilation/subdir.sb index 1395ed5c..28132138 100644 --- a/test/test_compilation/subdir.sb +++ b/test/test_compilation/subdir.sb @@ -1,6 +1,5 @@ { "bookoptions" : [ - "lilypond", "pictures" ], "datadir": ["subdir_datadir", "subdir_datadir2"], diff --git a/test/test_compilation/subdir.tex.control b/test/test_compilation/subdir.tex.control index 6caaa199..bd9ac649 100644 --- a/test/test_compilation/subdir.tex.control +++ b/test/test_compilation/subdir.tex.control @@ -25,7 +25,6 @@ \usepackage[ chorded, -lilypond, pictures, guitar, ]{patacrep} From 255788a2d23c203bf8619d0997b69f988ead1161 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:39:23 +0200 Subject: [PATCH 11/14] Log the output in case of command failure --- test/test_compilation/test_compilation.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index 3aad14eb..c4749257 100644 --- a/test/test_compilation/test_compilation.py +++ b/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. @@ -96,24 +98,14 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): 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), - ) - #temp fix for travis tests try: - val = subprocess.check_output( + subprocess.check_output( command, stderr=subprocess.STDOUT, universal_newlines=True, cwd=os.path.dirname(songbook), ) - print("###ok") - print(val) - print("ok###") + return 0 except subprocess.CalledProcessError as e: - print(e.output) - return 1 \ No newline at end of file + LOGGER.warning(e.output) + return e.returncode \ No newline at end of file From c2d44df20a92d1b9a94c1b0a1696824d53b06964 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:40:46 +0200 Subject: [PATCH 12/14] Clean code --- patacrep/songbook/__main__.py | 2 +- test/test_compilation/test_compilation.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index e205f5f8..5713b4a9 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -14,7 +14,7 @@ from patacrep import errors import patacrep.encoding # Logging configuration -logging.basicConfig(level=logging.DEBUG) +logging.basicConfig(level=logging.INFO) LOGGER = logging.getLogger() # pylint: disable=too-few-public-methods diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index c4749257..94fe810b 100644 --- a/test/test_compilation/test_compilation.py +++ b/test/test_compilation/test_compilation.py @@ -108,4 +108,4 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): return 0 except subprocess.CalledProcessError as e: LOGGER.warning(e.output) - return e.returncode \ No newline at end of file + return e.returncode From c1df24f0c01fdbc98f83b96d28e6af613621ff98 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:45:36 +0200 Subject: [PATCH 13/14] pylint compliance --- test/test_compilation/test_compilation.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index 94fe810b..b5ccf3fb 100644 --- a/test/test_compilation/test_compilation.py +++ b/test/test_compilation/test_compilation.py @@ -106,6 +106,6 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): cwd=os.path.dirname(songbook), ) return 0 - except subprocess.CalledProcessError as e: - LOGGER.warning(e.output) - return e.returncode + except subprocess.CalledProcessError as error: + LOGGER.warning(error.output) + return error.returncode From 8dd3f9a9318cdf872e83f9a7508d485c3901d40a Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Thu, 22 Oct 2015 19:45:55 +0200 Subject: [PATCH 14/14] Verbose compilation in tests --- test/test_compilation/test_compilation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index b5ccf3fb..812ba0ac 100644 --- a/test/test_compilation/test_compilation.py +++ b/test/test_compilation/test_compilation.py @@ -94,7 +94,7 @@ 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])