From ff24e14f5ec4e0349ce2f0ab289a8a0cab94bd80 Mon Sep 17 00:00:00 2001 From: Louis Date: Thu, 22 Oct 2015 17:19:15 +0200 Subject: [PATCH] [test] New placeholder test. --- test/test_compilation/subdir.tex.control | 4 ++-- test/test_compilation/test_compilation.py | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/test/test_compilation/subdir.tex.control b/test/test_compilation/subdir.tex.control index 0f182f9a..6caaa199 100644 --- a/test/test_compilation/subdir.tex.control +++ b/test/test_compilation/subdir.tex.control @@ -16,7 +16,7 @@ {@TEST_FOLDER@/subdir_datadir/latex/} % {@TEST_FOLDER@/subdir_datadir2/latex/} % {@TEST_FOLDER@/latex/} % - {@PACKAGE_FOLDER@/data/latex/} % + {@DATA_FOLDER@/latex/} % } \makeatother @@ -44,7 +44,7 @@ guitar, {@TEST_FOLDER@/subdir_datadir/} % {@TEST_FOLDER@/subdir_datadir2/} % {@TEST_FOLDER@/} % - {@PACKAGE_FOLDER@/data/} % + {@DATA_FOLDER@/} % } diff --git a/test/test_compilation/test_compilation.py b/test/test_compilation/test_compilation.py index 62c76c09..07a0857d 100644 --- a/test/test_compilation/test_compilation.py +++ b/test/test_compilation/test_compilation.py @@ -2,13 +2,14 @@ # pylint: disable=too-few-public-methods +from pkg_resources import resource_filename import glob import os import subprocess import unittest from patacrep.encoding import open_read -from pkg_resources import resource_filename +import patacrep from .. import dynamic # pylint: disable=unused-import @@ -93,13 +94,14 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): def assertMultiLineEqual(self, result, expected, msg=None): """Replace the placeholder paths with the local paths""" - placeholder = "@TEST_FOLDER@" - localpath = os.path.dirname(__file__) - expected = expected.replace(placeholder, localpath) + expected = expected.replace( + "@TEST_FOLDER@", + os.path.dirname(__file__), + ) - import patacrep - placeholder = "@PACKAGE_FOLDER@" - localpath = os.path.abspath(resource_filename(patacrep.__name__, '')) - expected = expected.replace(placeholder, localpath) + expected = expected.replace( + "@DATA_FOLDER@", + os.path.abspath(resource_filename(patacrep.__name__, 'data')), + ) return super().assertMultiLineEqual(result, expected, msg)