From 2107200e260cf7100b7e9c534e93d2db899d0b33 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 22 Oct 2015 18:17:10 +0200 Subject: [PATCH] [test] Use the right place holder --- test/test_compilation/test_compilation.py | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index 07a0857d..29d475f6 100644 --- a/test/test_compilation/test_compilation.py +++ b/test/test_compilation/test_compilation.py @@ -63,9 +63,24 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): tex = "{}.tex".format(base) with open_read(control) as expectfile: with open_read(tex) as latexfile: + expected = expectfile.read().strip() + expected = expected.replace( + "@TEST_FOLDER@", + os.path.dirname(__file__), + ) + + expected = expected.replace( + "@DATA_FOLDER@", + subprocess.check_output( + ["python", "-c", 'import patacrep, pkg_resources; print(pkg_resources.resource_filename(patacrep.__name__, "data"))'], + universal_newlines=True, + cwd=os.path.dirname(songbook), + ).strip(), + ) + self.assertMultiLineEqual( latexfile.read().strip(), - expectfile.read().strip(), + expected, ) # Check compilation @@ -90,18 +105,3 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): stderr=subprocess.DEVNULL, cwd=os.path.dirname(songbook), ) - - def assertMultiLineEqual(self, result, expected, msg=None): - """Replace the placeholder paths with the local paths""" - - expected = expected.replace( - "@TEST_FOLDER@", - os.path.dirname(__file__), - ) - - expected = expected.replace( - "@DATA_FOLDER@", - os.path.abspath(resource_filename(patacrep.__name__, 'data')), - ) - - return super().assertMultiLineEqual(result, expected, msg)